I'm trying to decide what is the best way to hide some pages so that they do not appear to the user on my navigation. I see in my XSLT template that umbracoNaviHide is being tested, but I cannot figure out how that value is being set. I see many forum threads showing examples of setting and testing this value, but I don't see how it initially gets a value. If umbracoNaviHide is a standard page value where and how is it being set?
How to I indicate that a content page should be hidden?
Let's say I have a navigation section with 2 sub content pages.
About Us
Company
Privacy Policy
If I want to hide the Privacy Policy page from the menu how I do that without hard coding a page Id in my navigation XSLT? Seems like there should be a standard page property that my content editors can set when they create a page, but I don't see anything like that on the content properties tab.
Any suggestions or best practices for this issue would be appreciated.
Typically you would add a property to your document type called umbracoNaviHide, with type True/False, and label something like "Hide in navigation?". This is the standard property that pretty much all Umbraco XSLT templates and community projects use to detect whether a page should be shown in the navigation.
I typically add this to my master doctype so it is available for all pages.
Wow, what a quick response from the forum. I hunted all over for a simple explanation of this. Works like a charm! Set it up, check the box and poof! it's gone.
So...I have umbracoNaviHide implemented, and checked on a few pages/folders, but it's not working. The sites and folders are still showing up in my nav. Here's the XSLT:
Ad you're sure that you have not made some kind of typo in the property alias for umbracoNaviHide on your document type? And it has been properly checked on the folders?
If so...have you published the nodes afterwards and have you republished the entire site by right clicking "content" and choosing "republish entire site"? (This is refreshing the XML cache). You can also open the umbraco.config file in the app_data folder to see if the property exists in the XML cache.
You're welcome. This is often easy to forget. But important to remember when one has made changes to document types. Then nodes MUST be published in order of the changes to take effect of coure...but sometims it's just so easy to forget...:-)
Navigation - how to hide a page or folder
I'm trying to decide what is the best way to hide some pages so that they do not appear to the user on my navigation. I see in my XSLT template that umbracoNaviHide is being tested, but I cannot figure out how that value is being set. I see many forum threads showing examples of setting and testing this value, but I don't see how it initially gets a value. If umbracoNaviHide is a standard page value where and how is it being set?
How to I indicate that a content page should be hidden?
Let's say I have a navigation section with 2 sub content pages.
About Us
Company
Privacy Policy
If I want to hide the Privacy Policy page from the menu how I do that without hard coding a page Id in my navigation XSLT? Seems like there should be a standard page property that my content editors can set when they create a page, but I don't see anything like that on the content properties tab.
Any suggestions or best practices for this issue would be appreciated.
You need to add umbracoNaviHide to your Doc Type.
It's just a convention, it does not get added by default.
Rich
To be clear, add umbracoNaviHide as a True/False property in the doc type you want to hide/show.
Then for a node you want to hide, simply check the umbracoNaviHide and publish.
Rich
Hi Janet,
Typically you would add a property to your document type called umbracoNaviHide, with type True/False, and label something like "Hide in navigation?". This is the standard property that pretty much all Umbraco XSLT templates and community projects use to detect whether a page should be shown in the navigation.
I typically add this to my master doctype so it is available for all pages.
Took some digging but I found a simple wiki article on it, and on the right you'll see other "standard"/special Umbraco properties you can add to your doctypes for different functionality: http://our.umbraco.org/wiki/reference/umbraco-best-practices/umbraconavihide
Thanks,
Tom
Too slow :)
Nicer explanation though Tom, and great link :)
Wow, what a quick response from the forum. I hunted all over for a simple explanation of this. Works like a charm! Set it up, check the box and poof! it's gone.
So...I have umbracoNaviHide implemented, and checked on a few pages/folders, but it's not working. The sites and folders are still showing up in my nav. Here's the XSLT:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp " "> ]>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxml="urn:schemas-microsoft-com:xslt"
xmlns:umbraco.library="urn:umbraco.library" xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes" xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions" xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets"
exclude-result-prefixes="msxml
umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes
Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings
Exslt.ExsltSets ">
<xsl:output method="xml" omit-xml-declaration="yes"/>
<xsl:param name="currentPage"/>
<!-- update this variable on how deep your site map should be -->
<xsl:variable name="maxLevelForSitemap" select="6"/>
<xsl:template match="/">
<div id="sitemap">
<xsl:call-template name="drawNodes">
<xsl:with-param name="parent" select="$currentPage/ancestor-or-self::* [@isDoc and @level=1]"/>
</xsl:call-template>
</div>
</xsl:template>
<xsl:template name="drawNodes">
<xsl:param name="parent"/>
<xsl:if test="umbraco.library:IsProtected($parent/@id,
$parent/@path) = 0 or (umbraco.library:IsProtected($parent/@id,
$parent/@path) = 1 and umbraco.library:IsLoggedOn() = 1)">
<ul>
<xsl:for-each select="$parent/*
[@isDoc and umbracoNaviHide != '1' and @level <=
$maxLevelForSitemap and string(@template) != '0' and name() !=
'HomeImage']">
<li>
<a href="{umbraco.library:NiceUrl(@id)}">
<xsl:value-of select="@nodeName"/></a>
<xsl:if test="count(./*
[@isDoc and umbracoNaviHide != '1' and @level <=
$maxLevelForSitemap and string(@template) != '0' and name() !=
'HomeImage']) > 0">
<xsl:call-template name="drawNodes">
<xsl:with-param name="parent" select="."/>
</xsl:call-template>
</xsl:if>
</li>
</xsl:for-each>
</ul>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
Hi Ben
Ad you're sure that you have not made some kind of typo in the property alias for umbracoNaviHide on your document type? And it has been properly checked on the folders?
If so...have you published the nodes afterwards and have you republished the entire site by right clicking "content" and choosing "republish entire site"? (This is refreshing the XML cache). You can also open the umbraco.config file in the app_data folder to see if the property exists in the XML cache.
Hope this helps
/Jan
Ahh, republishing everything made it work! Thanks a lot!
Hi Ben
You're welcome. This is often easy to forget. But important to remember when one has made changes to document types. Then nodes MUST be published in order of the changes to take effect of coure...but sometims it's just so easy to forget...:-)
/Jan
is working on a reply...