{% extends "base.html" %}

{% block main_content %}
{{ post_macros::page_header(title="blog posts") }}

<p>if you want to subscribe to updates, <a href="/atom.xml">an atom feed</a> is available.</p>

<div class="list">
  {%- if paginator %}
  {%- set show_pages = paginator.pages -%}
  {% else %}
  {% set section = get_section(path="posts/_index.md") %}
  {%- set show_pages = section.pages -%}
  {% endif -%}

  {{ post_macros::list_posts(pages=show_pages) }}
</div>
{% endblock main_content %}

{% block trailing_content %}
{% if paginator %}
<ul 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 %}
</ul>
{% endif %}
{% endblock trailing_content %}