{% extends "page.html" %}

{% block title %}
	<div class="header">
		<h1>{{ page.title }}</h1>
	</div>
{% endblock %}

{% block main %}
	{%- for item in index -%}
		{%- if loop.first -%}
			{%- set last_year = item.created.year -%}
			<h2 class="list-year">{{ item.created.year }}</h2>
			<ul class="list">

				{%- elif last_year != item.created.year -%}
					{%- set last_year = item.created.year -%}

			</ul>
			<h2 class="list-year">{{ item.created.year }}</h2>
			<ul class="list">
		{%- endif -%}
		<li>
		<a href='{{ item.rel_url }}'>{{ item.title }}</a><br>
		<small class="text-muted">Created at {{ item.created|strftime(commons.date_format) }}{%- if item.tags %} • Tags: {{ tags_list(item.tags, inline=True) }}{%- endif %} • Words: {{ item.content|wordcount }}</small>
		</li>
	{%- endfor -%}
	</ul>

	{% if page.tags -%}
		<h3>Tags</h3>
		{{ tags_list(page.tags, inline=False, count=True) }}
	{%- endif %}
{% endblock %}
