$page->prev([$sort, $direction])

Returns the previous sibling

  • $sort (string)
    An optional sort field for the siblings
  • $direction (string)
    An optional sort direction
  • return ($page)

Example

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

Using sort field

<?php if($prev = $page->prev('date', 'desc')): ?>
<a href="<?= $prev->url() ?>">previous page</a>
<?php endif ?>