Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
public class UmbracoSitemapService
private readonly UmbracoHelper _umbracoHelper;
public UmbracoSitemapService()
_umbracoHelper = new UmbracoHelper(UmbracoContext.Current);
public List<SitemapItem> GetItemsAsList(int startNodeId)
var sercher = ExamineManager.Instance.SearchProviderCollection["ExternalSearcher"];
var searchCriteria = sercher.CreateSearchCriteria();
searchCriteria.Field("searchPath", startNodeId.ToString())
.Not().Field("template", "0");
var sitemapItems = new List<SitemapItem>();
var results = sercher.Search(searchCriteria);
foreach (var result in results)
var node = _umbracoHelper.TypedContent(result.Id);
if (node != null)
var sitemapItem = new SitemapItem();
sitemapItem.Url = node.UrlAbsolute();
sitemapItem.Name = node.Name;
sitemapItem.LastUpdateDate =
return sitemapItems;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.