{% extends "index.html" %}

{% block title %}
{{ section.title }} | {{ section.description }}
{% endblock %}

{% block header %}
<header class="box-shadow">
    {{ macros::render_header() }}
</header>
{% endblock header %}

{% block content %}
<section class="text-center">
  <div class="heading-text">
    {{ section.title }}
  </div>
  <div class="subtitle-text">
    {{ section.description }}
  </div>
  <div class="content">
    {{ section.content | safe }}
  </div>
</section>

<section class="posts">
  {% if paginator %}
  {% set pages = paginator.pages %}
  {% else %}
  {% set pages = section.pages %}
  {% endif %}
    
  {% for page in pages %}
  <article class="text post">
    <h2 class="subtitle-text post-title">
      <a href="{{ page.permalink }}">
        {{ page.title }}
      </a>
    </h2>
    <div class="text post-summary">
      {{ page.summary | safe }}
    </div>
    <div class="text post-tags">
      tagged with
      {% for tag in page.taxonomies["tags"] %}
      <span class="tag">
        <a href="/tags/{{ tag }}">
          {{ tag }}
        </a>
      </span>
      {% endfor %}
    </div>
    <div class="read-more">
      <a href="{{ page.permalink }}">Read more...</a>
    </div>
  </article>
  {% endfor %}
</section>

<section class="navigation text text-center">
  {% if paginator.previous %}
  <a href="{{ paginator.previous | safe }}">← Newer</a>
  {% endif %}

  {% if paginator.next %}
  <a href="{{ paginator.next| safe }}">Older →</a>
  {% endif %}
</section>
{% endblock content %}