The Razor Site Map template in 4.7 produces empty ul tags which will show as errors in html validators. The simple fix to prevent thsi for people who are fussy about validating their html (like me), is to add a check for there being items before outputting the ul tag, so the relevant ul section becomes:
var items = node.Children.Where("Visible").Where("Level <= maxLevelForSitemap", values); if (items.Count() > 0) { <ul> @foreach (var item in items) { <li> <ahref="@item.Url">@item.Name</a> @traverse(item) </li> } </ul> }
var items = node.Children.Where("template!=0").Where("Visible").Where("Level <= maxLevelForSitemap", values);
because usually you dont want to display items that dont have a template, for example images that "lives" only in gallery and dont have thier "own" page.
Fix for Razor Sitemap html error - empty ul tags
The Razor Site Map template in 4.7 produces empty ul tags which will show as errors in html validators. The simple fix to prevent thsi for people who are fussy about validating their html (like me), is to add a check for there being items before outputting the ul tag, so the relevant ul section becomes:
i also changed the first line to:
because usually you dont want to display items that dont have a template, for example images that "lives" only in gallery and dont have thier "own" page.
This is great, make sure to contribute it back to Umbraco by creating an issue on codeplex about this. High five guys!
i open ticket in codeplex: http://umbraco.codeplex.com/workitem/30272
is working on a reply...