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

Ignore current in navigation

Is it possible to ignore the current page using an option in the perch_pages_navigation() function?

I've got a section with a few pages in it and I'd like to list the siblings only as this nav will appear at the bottom of the page saying something like "You've read that, now check out the other great pages in this section of the website".

https://docs.grabaperch.com/functions/navigation/perch-pages-navigation/

Thanks for keeping me right :)

Martin Underhill

Martin Underhill 5 points

  • 3 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

You can test for current_page in the template.

https://docs.grabaperch.com/templates/navigation/

Ah cool, so I'd just pass in a new template as an option outputting everything but the current page with that conditional. Cheers Drew :)

These opts:

    'template'=>'siblings.html',
    'hide-extensions'=>true,
    'hide-default-doc'=>true,
    'levels'=>1,
    'from-path'=>'*',
    'siblings'=>true,

plus this template:

<perch:before>
  <ul>
</perch:before>
  <perch:if exists="current_page"><perch:else />
    <li>
      <a href="<perch:pages id="pagePath" />"><perch:pages id="pageNavText" /></a>
    </li>
  </perch:if>
<perch:after>
  </ul>
</perch:after>

do the trick