public static string BuildSitemapHTML() { Item currentItem = Sitecore.Context.Item; SiteInfo currentSiteRoot = SiteContextFactory.Sites .Where(s => s.RootPath != "" && currentItem.Paths.Path.ToLower().StartsWith(s.RootPath.ToLower())) .OrderByDescending(s => s.RootPath.Length) .FirstOrDefault(); if (currentSiteRoot == null) { return(string.Empty); } Item root = SiteMapBuilder.GetTargetDatabase().GetItem(currentSiteRoot.RootPath); if (root == null) { return(string.Empty); } Item home = root.Children.FirstOrDefault(p => p.Name == "Home"); if (home == null) { return(string.Empty); } UrlOptions options = GetOptions(); StringBuilder sb = new StringBuilder(""); if (ShowNode(home.Fields[SiteMapFields.ShowInHTMLSiteMap])) { sb.AppendFormat("<ul class=\"site-map\">{0}</ul>", NodeWithMarkup(GetTitle(home), LinkManager.GetItemUrl(home, options))); sb.Append(GetSiteMapTree(home)); } return(sb.ToString()); }
protected static void Run(ClientPipelineArgs args) { var SyunObj = new SiteMapBuilder(); SyunObj.BuildSiteMap(); }