Check if page has multiple siblings

Hi guys,

I’m working on an article page.
I want to check if the page has listed siblings.
If that is the case I wan to display a block with Next and Prev listed articles.
If not I want to hide the block at all.

I tried this but it is not working:
<?php if($page->hasNextListed()): elseif($page->hasPrevListed()): ?>

or

<?php if($page->hasListedSiblings()): ?>

1 Like

You can check like that:

if ($page->siblings(false)->listed()->count() > 0) {
    // your codes
}

Or

<?php if ($page->siblings(false)->listed()->isNotEmpty()) : ?>
<!-- do stuff -->
<?php endif ?>

hasListedSiblings() does not exist…

Both work great! Learning a lot here. Thanks @ahmetbora & @texnixe