{% 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') %}
{# Carried in a namespace because a plain {% set %} does not outlive the
iteration that made it: the month would reset on every article, and
each one would open a list of its own. #}
{% set month = namespace(current=False) %}
{# The
opens inside one {% if %} and closes in two others, so djlint
cannot pair it up and drifts every tag that follows it. #}
{# djlint:off #}
{% for article in yearly_group.articles %}
{% if article.date.month != month.current %}
{% set month.current = article.date.month %}
{% if not loop.first %}