There is no more @nodeTypeAlias in the new 4.5 schema. The nodes are now named with their doctype alias, ie <HomeImage id="..">. You can check for it using name() - this should work:
<xsl:for-eachselect="$parent/* [@isDoc and string(umbracoNaviHide) != '1' and @level <= $maxLevelForSitemap and name() != 'HomeImage']">
Also, just as a side note, typically the pages I don't want to show in the sitemap/nav don't have an associated template (they aren't meant to be displayed as pages), so I check for them all using something like this. Easier than adding a bunch of conditions for each doctype
Hi - Sorry, you also need to duplicate the conditions in the xsl:if statement below the loop to fix that. Otherwise it calls the template again and writes a new UL for child nodes, which will be empty according to the for-each.
<xsl:for-eachselect="$parent/* [@isDoc and string(umbracoNaviHide) != '1' and @level <= $maxLevelForSitemap and string(@template) != '0']"> <li> <ahref="{umbraco.library:NiceUrl(@id)}"> <xsl:value-ofselect="@nodeName"/></a> <xsl:iftest="count(./* [@isDoc and string(umbracoNaviHide) != '1' and @level <= $maxLevelForSitemap and string(@template) != '0']) > 0"> <xsl:call-templatename="drawNodes">
If you just want to do it by doctypes, just keep adding to the conditions:
... and name() != 'HomeImage' and name() != 'AnotherType' ...
..etc. You will also need to add these conditions to the xsl:if statement as shown above. If you have a lot of doctypes you might be able to put them all in a comma separated string or XML variable and use something like contains() to check, but this is just a quick/simple way :)
It works like a charm! I'll be using a combination of the @template and doctype alias as some of the pages I want hidden from the sitemap will include templates.
Hide doctype from sitemap
I've been trying to hide a doctype from my site map, but when I do it causes the entire sitemap to disappear.
This is the offending line of code:
The only code that will display my site map is the following:
Does anyone have a solution?
JV
Hi JV
There is no more @nodeTypeAlias in the new 4.5 schema. The nodes are now named with their doctype alias, ie <HomeImage id="..">. You can check for it using name() - this should work:
-Tom
Also, just as a side note, typically the pages I don't want to show in the sitemap/nav don't have an associated template (they aren't meant to be displayed as pages), so I check for them all using something like this. Easier than adding a bunch of conditions for each doctype
string(@template) != '0'
Thanks Tom!
The first option works well. The pages I have don't have templates either so I tried implementing the following:
But it caused my sitemap to display incorrectly, everything in the red box should all be at the same level.
What would the code be if I had to add another doctype to be hidden?
Hi - Sorry, you also need to duplicate the conditions in the xsl:if statement below the loop to fix that. Otherwise it calls the template again and writes a new UL for child nodes, which will be empty according to the for-each.
If you just want to do it by doctypes, just keep adding to the conditions:
..etc. You will also need to add these conditions to the xsl:if statement as shown above. If you have a lot of doctypes you might be able to put them all in a comma separated string or XML variable and use something like contains() to check, but this is just a quick/simple way :)
Thanks Tom, you're a champ!
It works like a charm! I'll be using a combination of the @template and doctype alias as some of the pages I want hidden from the sitemap will include templates.
Here's my final code:
is working on a reply...