I have the problem that the first entry in the foreach function is always shown as active. Have I overlooked something?
Kirby Version: 3.8.1.1
Home is unlisted.
My Codes that i tried:
<?php
// main menu items
$items = $pages->listed()->filterBy('bottomMenu', false);
// only show the menu if items are available
if($items->isNotEmpty()):
?>
// loops listed below
<?php endif ?>
The difference between isActive() and isOpen() is that with isOpen() the menu item is still active when a subpage of the parent is active. While with isActive(), the menu item is only active when the page itself is active.
The two additional checks in your first example are redundant, because you already filter by listed status.
I have understood that as far as it goes. Only when I land on the home page after calling up the URL, the first page is marked as active although it is not the home page.
domain.de was called up and the page domain.de/about is shown as active. about is the first entry in the loop.
I don’t want to display the homepage in the menu. Hence my problem. My query only contains the pages that have been/will be created by me. But when I am on the homepage, the first entry is marked as active.
domain.tld => is called and shows the first entry in the menu as active although it is not the homepage but domain.tld/about.