Copied to clipboard

Flag this post as spam?

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

  • Matthew Jarvis 129 posts 129 karma points
    Jan 10, 2012 @ 16:53
    Matthew Jarvis

    2 types of NaviHide in Sitemap


    I currently use the properrty 'umbracoNaviHide' on my sitemap to hide pages I do not want to display in a sitemap.  This works great until.....I have a folder within my site that is in itself its own site and also uses umbracoNaviHide.

    Basically I have a top level domain name e.g SOMESITE.COM which is my main website, this site contains 10 different folders.  One of which is for a sub site that takes on the address of SOMESITE.COM/SOMEFOLDER

    For my main site sitemap I want to exclude SOMEFOLDER.  SOMEFOLDER site in itself uses umbracoNaviHide for navigation items so this cannot be used.

    The only solution I can think of is in my main site sitemap that I use 2 types of NaviHide such as 'UmbracoNaviHide' (which will hide main site folders and pages I want to exclude and a created one such as 'HideFolderFromMainSitemap (which will exclude from the main sitemap.

    Is this even possible and how would I write it, tried

    <xsl:if test="count(./* [@isDoc and string(umbracoNaviHide, HideFolderFromMainSitemap) != '1' and @level &lt;= $maxLevelForSitemap]) &gt; 0">

    but recieving XSLT errors.

    Any help much appreciated.






  • Matthew Jarvis 129 posts 129 karma points
    Jan 19, 2012 @ 16:06
    Matthew Jarvis

    Intentional bump :-)

  • Jeroen Breuer 4866 posts 12165 karma points MVP 3x admin c-trib
    Jan 19, 2012 @ 16:19
    Jeroen Breuer

    Don't know if you want to use Razor. Here is a slightly changed version of Cultiv his Razor sitemap:

    @helper ListChildNodes(dynamic startNode)
        Response.ContentType = "text/xml";
        const int maxLevelForSiteMap = 100;
        foreach (var node in startNode.Children
            if(node.template > 0 && !node.umbracoNaviHide) {
                    <lastmod>@(string.Format("{0:s}+00:00", node.UpdateDate))</lastmod>
                    @if (node.SearchEngineSitemapChangeFreq.ToString() != "")
                    @if (node.SearchEngineSitemapPriority.ToString() != "")
            if (node.Level <= maxLevelForSiteMap && node.ChildrenAsList.Count > 0)
    @functions {
        private static string GetUrlWithDomainPrefix(string url) {
            if (url.StartsWith("/"))
                url = url.Substring(1);
            var domainPrefix = string.Format("http://{0}/", HttpContext.Current.Request.ServerVariables["HTTP_HOST"]);
            if (url.StartsWith(domainPrefix))
                return url;
                return domainPrefix + url;

    The difference is that it will look at the children even if a parent has umbracoNaviHide set to true. So this means you can set a umbracoNaviHide to true and still display it's children if those have umbracoNaviHide set to false. Hope this is what you're looking for.


Please Sign in or register to post replies

Write your reply to: