---
layout: _includes/layouts/base.liquid
css:
- components.pagination.css
pagination:
  data: collections.posts
  size: 5
---
<div class="post-list">
  {%- for post in pagination.items -%}
  <article class="post">

    {% include '_includes/partials/timestamp.liquid', date: post.date %}

    <h2>
      {% if post.link %}
        <a href="{{ post.link }}">{{ post.data.title }}</a>
      {% else %}
        <a href="{{ post.url | url }}">{{ post.data.title }}</a>
      {% endif %}
    </h2>

    {% excerpt post %}

  </article>
  {%- endfor -%}
</div>

{% if pagination.pageLinks.length > 1 %}
<nav class="pagination">
  {% if pagination.previousPageLink %}
    <a class="pagination__item" href="{{ pagination.previousPageLink | remove: 'index.html' | url }}">Newer Articles</a>
  {% else %}
    <span class="pagination__item">Newer Articles</span>
  {% endif %}

  {% if pagination.nextPageLink %}
    <a class="pagination__item" href="{{ pagination.nextPageLink | remove: 'index.html' | url }}">Older Articles</a>
  {% else %}
    <span class="pagination__item">Older Articles</span>
  {% endif %}
</nav>
{% endif %}

---
layout: _includes/layouts/base.liquid
css:
- components.pagination.css
pagination:
  data: collections.posts
  size: 5
---
<div class="post-list">
  {%- for post in pagination.items -%}
  <article class="post">

    {% include '_includes/partials/timestamp.liquid', date: post.date %}

    <h2>
      {% if post.link %}
        <a href="{{ post.link }}">{{ post.data.title }}</a>
      {% else %}
        <a href="{{ post.url | url }}">{{ post.data.title }}</a>
      {% endif %}
    </h2>

    {% excerpt post %}

  </article>
  {%- endfor -%}
</div>

{% if pagination.pageLinks.length > 1 %}
<nav class="pagination">
  {% if pagination.previousPageLink %}
    <a class="pagination__item" href="{{ pagination.previousPageHref | url }}">Newer Articles</a>
  {% else %}
    <span class="pagination__item">Newer Articles</span>
  {% endif %}

  {% if pagination.nextPageLink %}
    <a class="pagination__item" href="{{ pagination.nextPageHref | url }}">Older Articles</a>
  {% else %}
    <span class="pagination__item">Older Articles</span>
  {% endif %}
</nav>
{% endif %}
