{% extends "base.html" %} {% block title %}Archives{% endblock title %} {% block top_center %}

Archives

{% endblock top_center %} {% block content %} {# Compute the spanning years all articles covers #} {% set year_range = [] %} {% for year in range(dates[-1].date.year, dates[0].date.year + 1) %} {# Gather all articles from current year #} {% set yearly_articles = [] %} {% for article in dates %} {% if article.date.year == year %} {% if yearly_articles.append(article) %} {% endif %} {% endif %} {% endfor %} {# Ignore empty years #} {% if yearly_articles|length > 0 %} {% if year_range.append({'year': year, 'articles': yearly_articles}) %} {% endif %} {% endif %} {% endfor %}
{% for yearly_group in year_range|sort(reverse = True, attribute = 'year') %}
{% set current_month = False %} {% for article in yearly_group.articles %} {% if article.date.month != current_month %} {% set current_month = article.date.month %} {% if not loop.first %}{% endif %}
{% endif %}
{{ article.date.strftime('%b. %d') }}
{{ article.title }}
{% if loop.last %}
{% endif %} {% endfor %}
{% endfor %}
{% endblock content %}