Require Kirby 2.3.
It’s based on “Jump step in a collection of pages - Back and forward”.
In a template or a snippet it’s possible to use $page->prev() and $page->next(). When at the end of a collection you will be hit by the end wall.
Sometimes it can be good not be bound by the walls. When using
$page->jump($steps)
you can step any direction and always get a page.
It’s similar to how an image slider or an ad rotator works.
For example you can do this:
echo $page->jump(-1)->title(); // Jump back one page in the collection
echo $page->jump(5)->title(); // Jump forward 5 steps
If there are only 3 pages the $page->jump(5)
will still echo a title because it will start over.