So I have next/prev links below my blog posts that (obviously) go to the next/previous post that was published. However, they’re not honouring the
published() date. Instead, it seems to be honouring the modified date.
So, when I get to my “Hello World” post, which was the first post I published and therefore the last post in the list, I still see an option to go to the “next post” which “Post Number 2” as that was modified after “Hello World”.
I do have a
date field, which is called
published. Here’s my code:
<div class="post-nav single"> <div> <?php if ($prev = $page->prevListed()): ?> <p>← The one before<br> <a href="<?= $prev->url() ?>"><?= $prev->title() ?></a></p> <?php endif ?> </div> <div class="post-nav-next"> <?php if ($next = $page->nextListed()): ?> <p> Up next →<br> <a href="<?= $next->url() ?>"><?= $next->title() ?></a></p> <?php endif ?> </div> </div>