Skip to content

Kirby 3.7.5

$page->nextListed()

Returns the next listed page if it exists

$page->nextListed(\Kirby\Cms\Collection|null $collection = null): Kirby\Cms\Page|null

Parameters

Name Type Default
$collection Kirby\Cms\Collection|null null

Return type

Kirby\Cms\Page|null

Parent class

Kirby\Cms\Page

Example

<?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 ?>