Reference

$page->next()

Returns the next item in the collection if available

$page->next(): Model|null

Return type

Model|null

Example

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

Using sort field

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

Source code

kirby/src/Cms/HasSiblings.php#L32