Skip to content

Kirby 6.0.0

$page->nextListed()

Returns the next listed page if it exists

$page->nextListed(Pages|null $collection = null): Page|null

Parameters

Name Type Default
$collection Kirby\Cms\Pagesornull null

Return types

Kirby\Cms\Pageornull

Parent class

Kirby\Cms\Page

Examples

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

Pass a collection

<?php
$collection = $page->siblings()->listed()->sortBy('date', 'desc');
if ($next = $page->nextListed($collection)): ?>
<a href="<?= $next->url() ?>">next listed page</a>
<?php endif ?>