jekyll-theme-isabelline/_includes/post_index.html
2020-08-31 21:07:53 -04:00

69 lines
1.8 KiB
HTML

{% assign title=include.title %}
{% if title != blank %}
<h1>{{ title }}</h1>
{% else %}
<h1>{{ include.posts | size }} blogs since {{ include.posts | sort: 'date' | map: 'date' | compact | first | date: '%Y' }}</h1>
{% endif %}
{% assign prev_year = 'first run' %}
{% assign sorted_posts = include.posts | sort: "date" | reverse %}
{% assign pinned_posts=sorted_posts | where: "pinned", 1 %}
{% if pinned_posts.size > 0 %}
<ul class="index">
{% for post in pinned_posts %}
<li>
<a href="{{ post.url | relative_url }}">{{ post.title }}</a>
<span class="posted">{{ post.date | date: "%b %-d, %Y" }}</span>
{% if jekyll.environment == "local" %}
{% if post.collection == 'private' %}
<span class="badge collection {{ post.collection }}">{{ post.collection }}</span>
{% endif %}
{% if post.draft %}
<span class="badge draft">draft</span>
{% endif %}
{% endif %}
</li>
{% endfor %}
</ul>
{% endif %}
{% for post in sorted_posts %}
{% assign current_year = post.date | date: "%Y" %}
{% if current_year != prev_year %}
{% if prev_year != 'first run' %}
</ul>
{% endif %}
{% assign prev_year = current_year %}
<h2 class="year">{{ current_year | default: '<em>undated</em>' }}</h2>
<ul class="index">
{% endif %}
<li>
<a href="{{ site.baseurl }}{{ post.url }}">{{ post.title }}</a>
<span class="posted">{{ post.date | date: "%b %-d" }}</span>
{% if jekyll.environment == "local" %}
{% if post.collection == 'private' %}
<span class="badge collection {{ post.collection }}">{{ post.collection }}</span>
{% endif %}
{% if post.draft %}
<span class="badge draft">draft</span>
{% endif %}
{% endif %}
</li>
{% if current_year != date %}
{% endif %}
{% endfor %}
{% if site.index.outro != blank %}
{{ site.index.outro }}
{% endif %}