{% extends "index.html" %}
{% block title %}Archivio {{ SITENAME }}{% endblock %}
{% block ogtitle %}Archivio {{ SITENAME }}{% endblock %}
{% block ogurl %}{{ SITEURL }}/archives.html{%endblock%}
{% block canonicalurl %}{{ SITEURL }}/archives.html{%endblock%}

{% block content %}
<div class="span9">
  <section>
    <h1>{% block content_title %}Archivio per data{% endblock %}</h1>

    {% for article in dates %}
    {% set this_year = article.date.strftime('%Y') %}

    {% if this_year != prev_year %}
    <div class="row-fluid archive_row">
      <div class="span1 archive_year">{{ this_year }}</div>
    </div>
    {% endif %}
    {% if this_year != prev_year or this_month != prev_month %}
    <div class="row-fluid archive_row">
      <div class="offset1 span1 archive_month">{{ this_month }}</div>
    </div>
    {% endif %}
    <div class="row-fluid archive_row">
      {% if this_month != prev_month or this_day != prev_day %}
      <div class="offset1 span1 archive_day">
        {{ this_day }}
      </div>
      {% endif %}
      <div class="{% if this_year == prev_year and this_month == prev_month and this_day == prev_day %}offset2 {% endif %}span10">
        <dd><a href="{{ SITEURL }}/{{ article.url }}">{{ article.title }}</a> <small>{{ article.category }}</small></dd>
      </div>
    </div>
    {% set prev_year = this_year %}
    {% set prev_month = this_month %}
    {% set prev_day = this_day %}
    {% endfor %}
  </section>
</div>
{% endblock %}