Skip to content

Kirby 4.1.2

$page->prevListed()

Returns the previous listed page

$page->prevListed(\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($prev = $page->prevListed()): ?>
<a href="<?= $prev->url() ?>">previous listed page</a>
<?php endif ?>

With collection as argument

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