{% extends 'base.html' %}

{% block title %}
Archives · {{ super() }}
{% endblock title %}

{% block head_description %}
Archives du {{ SITENAME|striptags|e }}.
{% endblock head_description %}

{% block meta_tags_in_head %}
{{ super() }}
{% from '_includes/_defaults.html' import FEATURED_IMAGE, ARCHIVES_URL with context %}
<meta property="og:title" content="Archives · {{ SITENAME|striptags|e }}"/>
<meta name="twitter:title" content="Archives · {{ SITENAME|striptags|e }}">
<meta property="og:url" content="{{ SITEURL }}/{{ ARCHIVES_URL }}" />
<meta property="og:description" content="Archives du {{ SITENAME|striptags|e }}" />
<meta name="twitter:description" content="Archives du {{ SITENAME|striptags|e }}">
<meta property="og:site_name" content="{{ SITENAME|striptags|e }}" />
<meta property="og:article:author" content="{{ AUTHOR }}" />
{% if FEATURED_IMAGE %}
<meta property="og:image" content="{{ FEATURED_IMAGE }}" />
<meta name="twitter:image" content="{{ FEATURED_IMAGE }}" >
{% endif %}
{% endblock meta_tags_in_head %}

{% block content %}
{% from '_includes/_defaults.html' import ARCHIVES_URL with context %}
<div class="row-fluid">
    <header class="page-header span10 offset2">
    <h1><a href="{{ SITEURL }}/{{ ARCHIVES_URL }}">Archives</a></h1>
    </header>
</div>
<div class="row-fluid">
    <div class="span10 offset2">
        <div class="blog-archives">
            {% for article in dates %}
                {% set year = article.date.strftime('%Y') %}
                {% if loop.first %}
                    <h2 id="{{ year }}"><a href="#{{ year }}">{{ year }}</a></h2>
                {% else %}
                    {% set prevyear = loop.previtem.date.strftime('%Y') %}
                    {% if prevyear != year %}
                        <h2 id="{{ year }}"><a href="#{{ year }}">{{ year }}</a></h2>
                    {% endif %}
                {% endif %}

                {% if loop.last %}
                    <div itemscope class="last-entry-of-year">
                {% else %}
                {% set next_year = loop.nextitem.date.strftime('%Y') %}

                    {% if next_year != year %}
                        <div itemscope class="last-entry-of-year">
                    {% else %}
                        <div itemscope>
                    {% endif %}
                {% endif %}

                <a href="{{ SITEURL }}/{{ article.url }}">
                    {{ article.title }}
                    {% if article.subtitle %}
                    <small class="subtitle">
                        {{ article.subtitle }}
                    </small>
                    {% endif %}
                </a>
                <time itemprop="dateCreated" datetime="{{ article.date.isoformat() }}">
                    {{ article.locale_date }}
                </time>
                </div>
            {% endfor %}
        </div>
    </div>
</div>

{% endblock content %}
