private static string GetSharedItemUrl(Item item, SiteContext site, Item parentItem) { var itemUrl = HtmlEncode(GetItemUrl(item, site)); var parentUrl = HtmlEncode(GetItemUrl(parentItem, site)); var siteConfig = new SitemapManagerConfiguration(site.Name); parentUrl = parentUrl.EndsWith("/") ? parentUrl : parentUrl + "/"; if (siteConfig.CleanupBucketPath) { var pos = itemUrl.LastIndexOf("/", StringComparison.Ordinal) + 1; var itemNamePath = itemUrl.Substring(pos, itemUrl.Length - pos); return(HtmlEncode(parentUrl + itemNamePath)); } else { var contentParentItem = SitemapManager.GetContentLocation(item); if (contentParentItem == null) { return(null); } var contentParentItemUrl = HtmlEncode(GetItemUrl(contentParentItem, site)); if (string.IsNullOrWhiteSpace(contentParentItemUrl)) { return(string.Empty); } itemUrl = itemUrl.Replace(contentParentItemUrl, string.Empty); return(string.IsNullOrWhiteSpace(itemUrl) ? string.Empty : HtmlEncode(parentUrl + itemUrl.Trim('/'))); } }
public static string GetSharedItemUrl(Item item, SiteContext site) { var parentItem = SitemapManager.GetSharedLocationParent(item); var itemUrl = HtmlEncode(GetItemUrl(item, site)); var parentUrl = HtmlEncode(GetItemUrl(parentItem, site)); parentUrl = parentUrl.EndsWith("/") ? parentUrl : parentUrl + "/"; var pos = itemUrl.LastIndexOf("/") + 1; var itemNamePath = itemUrl.Substring(pos, itemUrl.Length - pos); return(HtmlEncode(parentUrl + itemNamePath)); }
public void RefreshSitemap(object sender, EventArgs args) { var sites = SitemapManagerConfiguration.GetSiteNames(); foreach (var site in sites) { Log.Info("Sitemap Module - Function Has Been Started", this); var config = new SitemapManagerConfiguration(site); var sitemapManager = new SitemapManager(config); sitemapManager.SubmitSitemapToSearchenginesByHttp(); if (!config.GenerateRobotsFile) { continue; } sitemapManager.RegisterSitemapToRobotsFile(); Log.Info("Sitemap Module - Function Has Finished", this); } }