Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Ahoy,
I just encountered a bug in the Razor variant of the plugin, which made it crash when running.
I isolated the problem and fixed it. The new code is as follows:
@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") .Where("umbracoNaviHide == false")) { if(node.template > 0) { <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 crash was caused by an error in line 29:
node.ChildrenAsList.Count
Which should actually be
node.ChildrenAsList.Count()
Just put the parentheses in and it works again :)
Jan,
Thanks for posting this up as I had exactly the same issue.
Cheers,Mark.
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.
Continue discussion
Fix for crash of Razor-variant v1.0.2 in Umbraco 6.0.5
Ahoy,
I just encountered a bug in the Razor variant of the plugin, which made it crash when running.
I isolated the problem and fixed it. The new code is as follows:
The crash was caused by an error in line 29:
Which should actually be
Just put the parentheses in and it works again :)
Jan,
Thanks for posting this up as I had exactly the same issue.
Cheers,
Mark.
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.