{% extends "index.html" %}

{%- block title -%}
{{ title_macros::title(page_title=page.title, main_title=config.title) }}
{%- endblock -%}

{% block content %}
    <div class="post">
        <h1 class="post-title">{{ page.title }}</h1>

        {% set section = get_section(path="_index.md") %}

        {% set pages_by_year = section.pages | group_by(attribute="year") %}
        {%- for year, pages_in_year in pages_by_year %}
            <h2 class="year-divider">{{ year }}</h2>
            <ul>
            {%- for page in pages_in_year %}
                {%- if page.draft %}
                    {% continue %}
                {% endif -%}
                <li class="post-list">
                    <a href="{{ page.permalink | safe }}">
                        <span class="post-date">{{ page.date }}</span>
                        :: <span class="post-list-title">{{ page.title }}</span></a>
                    {{ post_macros::tags(page=page, short=true) }}
                </li>
            {%- endfor %}
            </ul>
        {%- endfor %}
    </div>
{% endblock content %}
