CMS Development

MMorisette
Participant

Blog Post Pagination - Endless Loop (Prev/Next)

If I'm on the first post and I want to be able to click "Prev" and get to the last post how would I accomplish this?

 

Similarly, if I'm on the last post and click "Next" I would like to loop to the first post.

 

File: blog-post.html

<!-- PAGINATION -->
<div class="pagination">
<div class="container">

<ul class="pagination-nav nav">
<li class="nav-item">
<a href="/{{ content.previous_post_slug }}"
class="{% if content.previous_post_slug %} {% else %}disabled {% endif %}nav-link nav-link-prev">Prev</a>
</li>
<li class="nav-item">
<a href="{{ group.absolute_url }}" class="nav-link nav-link-all btn btn-primary">
<span>See All Wërk</span>
</a>
</li>
<li class="nav-item">
<a href="/{{ content.next_post_slug }}"
class="{% if content.next_post_slug %} {% else %}disabled {% endif %}nav-link nav-link-next">Next</a>
</li>
</ul>

</div>
</div>
<!-- PAGINATION -->
0 Votes
0 Réponses

0 Réponses

Aucune réponse publiée pour l'instant

Personne n'a encore répondu à ce post. Revenez plus tard pour voir si une solution a été proposée, ou soumettez votre propre réponse pour aider d'autres utilisateurs.

Répondre à ce post

Si vous avez besoin d'aide pour publier une réponse, consultez la politique d'utilisation de la communauté.