We are transitioning over to a new forum platform. Please post new issues there. Existing threads will be dealt with here unless you choose to move them over. Visit the new forum

Forum

Thread tagged as: Question, Problem

Navigation pages getting incorrectly tagged as ancestors

Hi guys,

Currently have a nav group with 3 pages. The nav group is called top-navigation. My code to display this is;

perch_pages_navigation([
                            'levels'                => 1,
                            'navgroup'              => 'top-navigation',
                            'add-trailing-slash'    => true,
                        ]);
                    ?>

My template is;

<li<perch:if exists="current_page"> class="current"</perch:if><perch:if exists="ancestor_page"> class="ancestor"</perch:if>>
    <a href="<perch:pages id="pagePath" />"><perch:pages id="pageNavText" /></a>
    <perch:pages id="subitems" encode="false" />
</li>

However, when I click the first item. It gets assigned the class of current, but the other two items get the class of ancestor. There are no sub pages

Isi this a bug or my code?

Thanks, Terry

Terry Upton

Terry Upton 0 points

  • 5 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

So are you saying your nav group is totally flat?

Totally flat. 3 items all at the same level.

I have just re-saved the nav group and it has fixed it. The items were flat though. Honestly it was flat!!! Problem solved.