Skip to content

Previous / Next

These little snippets let you create a useful prev / next switcher navigation for your pages.

<?php if ($page->hasPrevListed()): ?>
<a href="<?= $page->prevListed()->url() ?>">previous page</a>
<?php endif ?>

<?php if ($page->hasNextListed()): ?>
<a href="<?= $page->nextListed()->url() ?>">next page</a>
<?php endif ?>
<?php if ($page->hasPrevUnlisted()): ?>
<a href="<?= $page->prevUnlisted()->url() ?>">previous page</a>
<?php endif ?>

<?php if($page->hasNextUnlisted()): ?>
<a href="<?= $page->nextUnlisted()->url() ?>">next page</a>
<?php endif ?>
<?php if ($page->hasPrev()): ?>
<a href="<?= $page->prev()->url() ?>">previous page</a>
<?php endif ?>

<?php if ($page->hasNext()): ?>
<a href="<?= $page->next()->url() ?>">next page</a>
<?php endif ?>