Can I add a full list of posts to the detail page?

Hello, I have a question!

There is a list of posts that are added with a specific template, where when I click the post, it goes to the detail page.

If I use this code on the post detail page and through snippets, I can add only one post in front and back of the post to the floor.

<?php
?>
<nav class="blog-prevnext">
  <h2 class="h2">Keep on reading</h2>

  <div class="autogrid" style="--gutter: 1.5rem">
    <?php if ($prev = $page->prevListed()): ?>
    <?php snippet('note', ['note' => $prev, 'excerpt' => false])  ?>
    <?php endif ?>

    <?php if ($next = $page->nextListed()): ?>
    <?php snippet('note', ['note' => $next, 'excerpt' => false])  ?>
    <?php endif ?>
  </div>
</nav> 

On the post detail page, can I automatically add all but that post?

Please help me.
Thank you.

Yes, but then you would not use prev() and next(), but fetch all siblings ($page->siblings(false), i.e. all siblings but the current page), and loop through them.

1 Like