blob: 6a62925a34adc2f40a2d48b2fdfd14645aad5cc8 [file] [log] [blame]
<nav class="pagination">
{% capture collection_name %}{{ include.collection }}{% endcapture %}
{% for post in site.[collection_name] %}
{% if post.url == page.url %}
{% assign post_index0 = forloop.index0 %}
{% assign post_index1 = forloop.index %}
{% endif %}
{% endfor %}
{% for post in site.[collection_name] %}
{% if post_index0 == forloop.index %}{% assign next_post = post %}{% endif %}
{% if post_index1 == forloop.index0 %}{% assign prev_post = post %}{% endif %}
{% endfor %}
{% if prev_post %}<a class="prev" href="{{ site.url }}{{ prev_post.url }}">{{ prev_post.title }}</a>{% endif %}
{% if next_post %}<a class="next" href="{{ site.url }}{{ next_post.url }}">{{ next_post.title }}</a>{% endif %}
</nav>