Forum

Thread tagged as: Question

Disable top level pages

Hi

When generating menus using perch_pages_navigation is it possible to disable links from top level pages but still have them showing in navigation menus?

e.g. I have a navigational menu with a drop down. The top link doesn't actually do anything other than activate a drop down with sub page items. I want the navigation to generate the sub menu but not add a link to the top level page.

You can see via the link the menu in question titled products and markets.

My working html-only template is here

Ideally in perch control panel I'd like the parent page to be titled "market "with subpages under it of "industrial, sports, etc" without the market parent being an actual page – just a master page template.

Am I being thick here?

Many thanks in advance,

Jon

Jonathan Elliman

Jonathan Elliman 27 points

  • 7 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

You can test for pageDepth. Anything on the top level has a pageDepth of 1

<perch:if id="pageDepth" match="gte" value="2">
    <a href="<perch:pages id="pagePath" />">
        <perch:pages id="pageNavText" />
    </a>
<perch:else />
    <perch:pages id="pageNavText" />
</perch:if>

Ha ha - I slept on it and this is pretty much the solution I came up with this morning! Thank you Drew.

If anyone else is looking for another solution to this I used

<perch:if exists="subitems">

in the end to check for the existence of sub menu items. I ended up at this because there were other top level menu items that I wanted to generate links for.