{% extends 'base.html' %}

{% block title %}
All Posts · {{ super() }}
{% endblock title %}

{% block head_description %}
Full archives of {{ SITENAME|striptags|e }} blog.
{% endblock head_description %}

{% block meta_tags_in_head %}
{{ super() }}
<meta property="og:title" content="All Posts · {{ SITENAME|striptags|e }}"/>
<meta name="twitter:title" content="All Posts · {{ SITENAME|striptags|e }}">
<meta property="og:url" content="{{ SITEURL }}/archives.html" />
<meta property="og:description" content="Full archives of {{ SITENAME|striptags|e }} blog" />
<meta name="twitter:description" content="Full archives of {{ SITENAME|striptags|e }} blog">
<meta property="og:site_name" content="{{ SITENAME|striptags|e }}" />
<meta property="og:article:author" content="{{ AUTHOR }}" />
{% from '_includes/_defaults.html' import FEATURED_IMAGE with context %}
{% 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 %}

<div class="row-fluid">
    <header class="page-header span10 offset2">
    <h1><a href="{{ SITEURL }}/archives.html">All Posts</a></h1>
    </header>
</div>
<div class="row-fluid">
    <div class="span10 offset2">
        <div class="blog-archives">
            {% set last_year = {'lastyear': 0} %}
            {% for article in dates %}
            {% set year = article.date.strftime('%Y') %}
            {%if last_year.lastyear != year %}
            <h2 id="{{year }}"><a href="#{{year}}">{{ year }}</a></h2>
            {% set _dummy = last_year.update({'lastyear': year}) %}
            {% endif %}
            {% set next_year = 0 %}
            {% if not loop.last %}
            {% set next = loop.index0 + 1 %}
            {% set next_article = dates[next] %}
            {% set next_year = next_article.date.strftime('%Y') %}
            {% endif %}
            {% if next_year != year %}
            <article class="last-entry-of-year">
            {% else %}
            <article>
            {% endif %}
            <a href="{{ SITEURL }}/{{ article.url }}">{{ article.title }} {%if article.subtitle %} <small> {{ article.subtitle }} </small> {% endif %} </a>
            <time pubdate="pubdate" datetime="{{ article.date.isoformat() }}">{{ article.locale_date }}</time>
            </article>
            {% endfor %}
        </div>
    </div>
</div>

{% endblock content %}
