{% if include.title == blank %}
	<h1>{{ include.posts | size }} blogs since {{ include.posts | sort: 'date' | map: 'date' | compact | first | date: '%Y' }}</h1>
{% else if %}
	<h1>{{ include.title }}</h1>
{% endif %}

{% assign prev_year = 'first run' %}
{% assign sorted_posts = include.posts | sort: "date" | reverse %}
{% 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 %}
