Thread tagged as: Question

Excluding current page from navigation output


I am using the following to output navigation on my page:

            'from-path' => '/mypath',
            'template' => 'mytemplate.html',
            'hide-extensions' => true

Now I would like to exclude the page that I am currently on, from the navigation, is this possible?


Mike Hendriks

Mike Hendriks 0 points

  • 2 years ago
Hussein Al Hammad

Hussein Al Hammad 105 points
Registered Developer

Hello Mike,

One option would be to exclude it in the template with conditional tags:


<perch:if not-exists="current_page">
        <a href="<perch:pages id="pagePath" />"><perch:pages id="pageNavText" /></a>   
        <perch:pages id="subitems" encode="false" />


Thank you, Hussein. I was using <perch:if exists="current_page">...</perch:else>...", but it was not working. not-exists works.

Drew McLellan

Drew McLellan 2638 points
Perch Support

</perch:else> should be <perch:else /> or <perch:else>