How to remove 'Next' button in custom prev-next setup on the last page

Nov 24, 2014 4:56 pm

Have you used the [[next_url]] and [[previous_url]] tags to customize your previous-next buttons? You may have run into a common problem that other users like you have run into. That is, on the last page of a multi-page article, blog, etc. you will still see a 'Next' button implying that there is another page, misleading your users. Not only that, but it also jumps back to the first page, exposing a glitch in your site.

Shockingly, there is a really simple fix to this problem. There is also a tag named ‘[[Next]]’, and this tag returns false when there isn’t another page after the current. So, we can use that tag in a conditional that wraps around the custom ’Next’ button in the page layout like such:


<if [[next]]>
    <a href=“[[next_url]]” class=“yourcustomclass”>Your Custom Text</a>
</if>

This will not display the ’Next’ button when there isn’t another page.

I hope this was some help to you. If you have any questions or concerns, please feel free to contact us.