Could anybody help me to learn how to exclude certain pages from my sitemap (for example, all specials on my website I would like to remove from sitemap). Thank you in advance. Here is my code:
@inherits Umbraco.Web.Macros.PartialViewMacroPage
@{
var rootNode = CurrentPage.AncestorOrself(1);
}
Hi Emma.
So looking at the code, the sitemap excludes all nodes that has a true value for the property "umbracoNaviHide", so you can add a property's to your "special" doctypes with the alias "umbracoNaviHide" of the datatype of a checkbox. That way you can exclude specific nodes by checking that checkbox for a specific node.
Another way to quickly exclude a bunch of nodes of the same doctype, is to exclude a specific doctype that you don't want to have in your sitmap. For instance:
var items = node.Children.Where("DocumentTypeAlias != aliasForTheDoctypeYouWantToEclude");
Hope any of this information was useful to you. Hope you enjoy Umbraco so far!
Exclude pages from showing in sitemap
Could anybody help me to learn how to exclude certain pages from my sitemap (for example, all specials on my website I would like to remove from sitemap). Thank you in advance. Here is my code:
@inherits Umbraco.Web.Macros.PartialViewMacroPage
@{
var rootNode = CurrentPage.AncestorOrself(1); }
@helper Traverse(IPublishedContent node){
}
Hi Emma. So looking at the code, the sitemap excludes all nodes that has a true value for the property "umbracoNaviHide", so you can add a property's to your "special" doctypes with the alias "umbracoNaviHide" of the datatype of a checkbox. That way you can exclude specific nodes by checking that checkbox for a specific node.
Another way to quickly exclude a bunch of nodes of the same doctype, is to exclude a specific doctype that you don't want to have in your sitmap. For instance:
var items = node.Children.Where("DocumentTypeAlias != aliasForTheDoctypeYouWantToEclude");
Hope any of this information was useful to you. Hope you enjoy Umbraco so far!
Take care! / Dennis
This worked like a charm! Thank you, Dennis.
Glad to help! Have a great day!!! :)
is working on a reply...