Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Janet Kirklen 102 posts 212 karma points
    Oct 28, 2010 @ 17:00
    Janet Kirklen
    0

    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.

  • Rich Green 2246 posts 4008 karma points
    Oct 28, 2010 @ 17:11
    Rich Green
    1

    You need to add umbracoNaviHide to your Doc Type.

    It's just a convention, it does not get added by default.

    Rich

  • Rich Green 2246 posts 4008 karma points
    Oct 28, 2010 @ 17:13
    Rich Green
    0

    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

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Oct 28, 2010 @ 17:14
    Tom Fulton
    0

    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

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Oct 28, 2010 @ 17:15
    Tom Fulton
    1

    Too slow :)

  • Rich Green 2246 posts 4008 karma points
    Oct 28, 2010 @ 17:16
    Rich Green
    0

    Nicer explanation though Tom, and great link :)

  • Janet Kirklen 102 posts 212 karma points
    Oct 29, 2010 @ 01:25
    Janet Kirklen
    0

    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.

  • Ben Price 15 posts 35 karma points
    Feb 02, 2011 @ 08:40
    Ben Price
    0

    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 "&#x00A0;"> ]>
    <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 &lt;= 
    $maxLevelForSitemap and string(@template) != '0' and name() != 
    'HomeImage']">
        
    <li>  
    <href="{umbraco.library:NiceUrl(@id)}">
    <xsl:value-of select="@nodeName"/></a>  
    <xsl:if test="count(./*
     [@isDoc and umbracoNaviHide != '1' and @level &lt;= 
    $maxLevelForSitemap and string(@template) != '0' and name() != 
    'HomeImage']) &gt; 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>

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Feb 02, 2011 @ 08:43
    Jan Skovgaard
    0

    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

  • Ben Price 15 posts 35 karma points
    Feb 02, 2011 @ 08:45
    Ben Price
    0

    Ahh, republishing everything made it work!  Thanks a lot!

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Feb 02, 2011 @ 08:48
    Jan Skovgaard
    0

    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

Please Sign in or register to post replies

Write your reply to:

Draft