Display previous and next post pagination if there is more than one post

This commit is contained in:
Helen Chong 2024-10-09 19:14:04 +08:00
parent cfd77e4af2
commit eb212af7ce
1 changed files with 2 additions and 2 deletions

View File

@ -51,8 +51,8 @@
{{ content | safe }}
{% if tags and tags.includes("posts") %}
{%- if collections.posts.length > 1 %}
<nav class="blog__post--pagination" aria-labelledby="nextprev-title">
{%- if collections.posts %}
<h2 class="visually-hidden" id="nextprev-title">Next and Previous Blog Posts</h2>
{%- set previousPost = collections.posts | getPreviousCollectionItem %}
{%- set nextPost = collections.posts | getNextCollectionItem %}
@ -72,8 +72,8 @@
{% endif %}
</ul>
{%- endif %}
{%- endif %}
</nav>
{%- endif %}
{% endif %}
</{{contentEl}}>