Umbraco newbie here. I'm following the documentation below to create a sitemap in Umbraco 8.1:
https://our.umbraco.com/documentation/tutorials/Creating-an-XML-Site-Map/
Everything seems fine but when I try to put live I get the error: error CS1525: Invalid expression term '<'
It seems to not be liking the HTML tags starting at URL - i've tried a few variants on Html.Raw() but it doesn't seem to work. Any help appreciated.
@{
void RenderSiteMapUrlEntry(IPublishedContent node)
{
var changeFreq = node.Value("searchEngineChangeFrequency", fallback: Fallback.To(Fallback.Ancestors, Fallback.DefaultValue), defaultValue: "monthly");
// with the relative priority, this is a per page setting only, so we're not using recursion, so we won't set Fallback.ToAncestors here and we'll default to 0.5 if no value is set
var priority = node.HasValue("searchEngineRelativePriority") ? node.Value("searchEngineRelativePriority") : "0.5";
<url>
<loc>@node.Url(mode: UrlMode.Absolute)</loc>
<lastmod>@(string.Format("{0:s}+00:00", node.UpdateDate))</lastmod>
<changefreq>@changeFreq</changefreq>
<priority>@priority</priority>
</url>
}
Resolved. I was using the code from Umbraco versions 9 & 10 - i'm using 8 so this worked:
https://our.umbraco.com/Documentation/Tutorials/Creating-an-XML-Site-Map/index-v8