# Blog Post Pagination - Endless Loop (Prev/Next)

**URL:** <https://community.hubspot.com/t/blog-post-pagination-endless-loop-prev-next/73958>\
**Category:** CMS Development\
**Created:** [January 27, 2023, 9:52pm UTC](https://community.hubspot.com/t/blog-post-pagination-endless-loop-prev-next/73958 "2023-01-27T21:52:43Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![MMorisette](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/mmorisette/32/69372_2.png) [@MMorisette](https://community.hubspot.com/u/MMorisette)\
**Post date:** [January 27, 2023, 9:52pm UTC](https://community.hubspot.com/t/blog-post-pagination-endless-loop-prev-next/73958/1 "2023-01-27T21:52:43Z")

</div>

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 --\>
