   {% 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 %}
    <div class="accordion"
         id="acco