Why are my excluded Plone items still showing up in navigation?
Plone comes with a useful way to hide certain items from the navigation menu. On the page’s properties tab, you can select “exclude from navigation” and the item won’t show up anymore in the navigation bar or site map.
… at least, that’s what you would think. You’ll notice that if you navigate to the page you excluded (by following a link or typing in its URL directly), it will show up in the navigation again!
The fix involves some Zope template code:
- Open up the ZMI, and customize /portal_skins/plone_portlets/portlet_navtree_macro if you don’t have it customized already.
- Look for a line of code about 20 lines down that says:
tal:condition="python: bottomLevel <= 0 or level < bottomLevel-1">
- Change the line to read:
tal:condition="python: (bottomLevel <= 0 or level < bottomLevel-1) and (not item.exclude_from_nav)">
Now your item will never show up in the navigation tools as long as it’s excluded.