{% extends "index.html" %}

{% block header %}
<h1>{{ section.title }}</h1>
{% endblock header %}

{% block main_content %}
{% if section.extra.section_path -%}
{% set section = get_section(path=section.extra.section_path) %}
{% endif -%}

{%- if section.extra.desc %}
  {{ post_macros::page_desc(desc=section.extra.desc) }}
{% endif -%}

<main class="list">
  {%- if paginator %}
  {%- set show_pages = paginator.pages -%}
  {% else %}
  {%- set show_pages = section.pages -%}
  {% endif -%}

  {{ post_macros::list_posts(pages=show_pages) }}
</main>

{% if paginator %}
<div class="pagination">
  {% if paginator.previous %}
  <span class="page-item page-prev">
    <a href={{ paginator.previous }} class="page-link" aria-label="Previous"><span aria-hidden="true">← Prev</span></a>
  </span>
  {% endif %}

  {% if paginator.next %}
  <span class="page-item page-next">
    <a href={{ paginator.next }} class="page-link" aria-label="Next"><span aria-hidden="true">Next →</span></a>
  </span>
  {% endif %}
</div>
{% endif %}
{% endblock main_content %}
