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 <= $maxLevelForSitemap]) > 0">
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.
2 types of NaviHide in Sitemap
Hi,
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
but recieving XSLT errors.
Any help much appreciated.
Intentional bump :-)
Don't know if you want to use Razor. Here is a slightly changed version of Cultiv his Razor sitemap:
@ListChildNodes(Model.AncestorOrSelf(1)) @helper ListChildNodes(dynamic startNode) { Response.ContentType = "text/xml"; const int maxLevelForSiteMap = 100; foreach (var node in startNode.Children .Where("HasAccess") .Where("!IsProtected") ) { if(node.template > 0 && !node.umbracoNaviHide) { <url> <loc>@GetUrlWithDomainPrefix(node.Url)</loc> <lastmod>@(string.Format("{0:s}+00:00", node.UpdateDate))</lastmod> @if (node.SearchEngineSitemapChangeFreq.ToString() != "") { <changefreq>@node.SearchEngineSitemapChangeFreq</changefreq> } @if (node.SearchEngineSitemapPriority.ToString() != "") { <priority>@node.SearchEngineSitemapPriority</priority> } </url> } if (node.Level <= maxLevelForSiteMap && node.ChildrenAsList.Count > 0) { @ListChildNodes(node) } } } @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; else 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.
Jeroen
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.