{% extends 'theme/base.html' %}

{% block page_title %}Archives{% endblock %}

{% block nav_secondary %}
    {# No secondary nav. #}
{% endblock %}

{% block section_main_class %}
    {{ super() }} archives
{% endblock %}

{% block header_secondary_h1_class %}twelve columns{% endblock %}

{% block header_secondary_title %}
    {{ self.page_title() }}
{% endblock %}

{% block section_main_content %}
    {% for year, posts in post_list|groupby('timestamp.year')|sort(reverse=True, attribute='grouper') %}
        <div class="row">
            <div class="two columns"><h2><a name="{{ year }}"></a>{{ year }}</h2></div>
            <div class="ten columns">
                {% for post in posts %}
                    <article class="row">
                        <div class="two columns post-date">
                            {{ post.timestamp_local|date('%d %b') }}
                        </div>
                        <div class="ten columns">
                            <h1><a href="{{ post.url }}">{{ post.title }}</a></h1>
                        </div>
                    </article>
                {% endfor %}
            </div>
        </div>
    {% endfor %}
{% endblock %}

{% block section_sidebar_content %}
    <section>
        <nav>
            <ul>
                {% for year, posts in post_list|groupby('timestamp.year')|sort(reverse=True, attribute='grouper') %}
                    <li><a href="#{{ year }}">{{ year }}</a></li>
                {% endfor %}
            </ul>
        </nav>
    </section>
{% endblock %}
