Reference

$page->prevUnlisted()

Returns the previous unlisted page

$page->prevUnlisted(): self|null

Return type

self|null

Example

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

Using sort field

<?php if($prev = $page->prevUnlisted('title', 'asc')): ?>
<a href="<?= $prev->url() ?>">previous unlisted page</a>
<?php endif ?>

Source code

kirby/src/Cms/PageSiblings.php#L150