Front-end sitemap autonav - hide some pages?
Permalink
Hi all
I have a sitemap (autonav) which generates a nice list of the pages on my site. It's set up so it doesn't honour the 'Exclude from Nav' selections on individual pages (the site map should show everything). Those pages have 'Exclude from nav' ticked for aesthetic reasons (I don't want them showing up in the menus).
Here's the custom template code I am using:
The problem is that I need it to hide certain pages (like Search, Search Results, and a set of news pages that I have which will grow very large over time, making the Sitemap look terrible).
Is this possible? Is it possible to create a further page attribute (or something) to definitively remove a page from the above sitemap?
Any help much appreciated :)
I have a sitemap (autonav) which generates a nice list of the pages on my site. It's set up so it doesn't honour the 'Exclude from Nav' selections on individual pages (the site map should show everything). Those pages have 'Exclude from nav' ticked for aesthetic reasons (I don't want them showing up in the menus).
Here's the custom template code I am using:
<?php defined('C5_EXECUTE') or die(_("Access Denied.")); $aBlocks = $controller->generateNav(); $c = Page::getCurrentPage(); echo("<ul class=\"nav sitemap\">"); $nh = Loader::helper('navigation'); //this will create an array of parent cIDs $inspectC=$c; $selectedPathCIDs=array( $inspectC->getCollectionID() ); $parentCIDnotZero=true; while($parentCIDnotZero){ $cParentID=$inspectC->cParentID; if(!intval($cParentID)){ $parentCIDnotZero=false; }else{
Viewing 15 lines of 60 lines. View entire code block.
The problem is that I need it to hide certain pages (like Search, Search Results, and a set of news pages that I have which will grow very large over time, making the Sitemap look terrible).
Is this possible? Is it possible to create a further page attribute (or something) to definitively remove a page from the above sitemap?
Any help much appreciated :)
That worked great, thanks!
(although I had to apply the attribute to each individual (existing) page which I wanted to hide, even though I set the attribute to be checked by default for that page type. It seems that the attribute becomes available and is ticked, but it isn't actually set for those pages til it gets 're-ticked' and then saved.)
(although I had to apply the attribute to each individual (existing) page which I wanted to hide, even though I set the attribute to be checked by default for that page type. It seems that the attribute becomes available and is ticked, but it isn't actually set for those pages til it gets 're-ticked' and then saved.)
Create a page attribute called 'Exclude from Sitemap' with handle 'sitemap_exclude' and type of Boolean.
Then alter your code to read:
I haven't run the code this is just loosely put together.
KR
O