Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Umbraco Xml Sitemap using Razor
<rule name="Xml Sitemap">
<match url="sitemap.xml"/>
<action type="Rewrite" url="xmlsitemap"/>
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage
Layout = null;
var root = Umbraco.TypedContentSingleAtXPath("//homePage");
<urlset xmlns="">
@helper renderUrl(IPublishedContent node)
var changeFreq = (node.HasValue("changeFrequency")) ? node.GetPropertyValue<string>("changeFrequency").ToLower() : "monthly";
var priority = node.GetPropertyValue<double>("crawlPriority");
<priority>@((priority == 0) ? 0.5 : priority)</priority>
if (node.Children.Any())
foreach (var child in node.Children)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment