private void GeneratePageSitemap() { Sitemap map = new Sitemap(); string outputPath = string.Format(@"{0}\page-sitemap.xml", _sitemapOutputPath); SitemapLocation l1 = new SitemapLocation() { Url = _domain, LastModified = DateTime.Now }; SitemapLocation l2 = new SitemapLocation() { Url = string.Format("{0}/about", _domain), LastModified = DateTime.Now, Images = new List <SitemapImage>() { new SitemapImage() { Location = string.Format("{0}/assets/images/me.jpg", _domain) } } }; map.Add(l1); map.Add(l2); map.WriteSitemapToFile(outputPath); }
public async Task <IActionResult> GetSitemap() { var page = 1; var key = "sitemap"; IPagedList <Publication> pagedResult; var xml = _cache.Get(key)?.ToString(); if (string.IsNullOrEmpty(xml)) { var sitemap = new Sitemap(); sitemap.Add(CreateUrl(Settings.Current.WebSiteUrl)); sitemap.Add(CreateUrl(Settings.Current.WebSiteUrl + "partners/")); do { pagedResult = await _manager.GetPublications(page); page++; foreach (var p in pagedResult) { var publication = new PublicationViewModel(p, Settings.Current.WebSiteUrl); sitemap.Add(CreateUrl(publication.ShareUrl)); } }while (pagedResult.HasNextPage); xml = sitemap.ToXml(); _cache.Set(key, xml, TimeSpan.FromMinutes(10)); } return(Content(xml, Sitemap.MimeType)); }
/// <summary> /// Filters the current sitemap collection to only include the items the /// current user has access to. Please note that this only filters the /// current collection, it doesn't filter the entire strucure. /// </summary> /// <param name="sitemap">The sitemap items</param> /// <param name="user">The current user</param> /// <param name="auth">The authorization service</param> /// <returns>The filtered collection</returns> public static async Task <IEnumerable <SitemapItem> > ForUserAsync(this IEnumerable <SitemapItem> sitemap, ClaimsPrincipal user, IAuthorizationService auth) { var result = new Sitemap(); foreach (var item in sitemap) { if (item.Permissions.Count == 0) { result.Add(item); } else { var success = true; foreach (var permission in item.Permissions) { if (!(await auth.AuthorizeAsync(user, permission)).Succeeded) { success = false; break; } } if (success) { result.Add(item); } } } return(result); }
public async Task <IActionResult> GetSitemap() { var page = 1; var key = "sitemap"; var xml = _cache.Get(key)?.ToString(); if (string.IsNullOrEmpty(xml)) { IPagedList <Publication> publications; IPagedList <Vacancy> vacancies; var sitemap = new Sitemap(); var events = GetCustomPages(); foreach (var url in events) { sitemap.Add(CreateUrl(url)); } page = 1; do { publications = await _publicationService.GetPublications(null, page); page++; foreach (var p in publications) { var publication = new PublicationViewModel(p, _settings.WebSiteUrl); sitemap.Add(CreateUrl(publication.ShareUrl.ToString())); } }while (publications.HasNextPage); page = 1; do { vacancies = await _vacancyService.GetVacancies(page); page++; foreach (var v in vacancies) { var vacancy = new VacancyViewModel(v, _settings.WebSiteUrl); sitemap.Add(CreateUrl(vacancy.ShareUrl.ToString())); } }while (vacancies.HasNextPage); xml = sitemap.ToXml(); _cache.Set(key, xml, TimeSpan.FromMinutes(10)); } return(Content(xml, "application/xml")); }
public async Task <IActionResult> GetSitemap() { var page = 1; var key = "sitemap"; var xml = _cache.Get(key)?.ToString(); if (string.IsNullOrEmpty(xml)) { IPagedList <Publication> publications; IPagedList <Vacancy> vacancies; var sitemap = new Sitemap(); sitemap.Add(CreateUrl(Settings.Current.WebSiteUrl)); sitemap.Add(CreateUrl(Settings.Current.WebSiteUrl + "partners/")); page = 1; do { publications = await _publicationManager.GetPublications(null, page); page++; foreach (var p in publications) { var publication = new PublicationViewModel(p, Settings.Current.WebSiteUrl); sitemap.Add(CreateUrl(publication.ShareUrl)); } }while (publications.HasNextPage); page = 1; do { vacancies = await _vacancyManager.GetVacancies(page); page++; foreach (var v in vacancies) { var vacancy = new VacancyViewModel(v, Settings.Current.WebSiteUrl); sitemap.Add(CreateUrl(vacancy.ShareUrl)); } }while (vacancies.HasNextPage); xml = sitemap.ToXml(); _cache.Set(key, xml, TimeSpan.FromMinutes(10)); } return(Content(xml, Sitemap.MimeType)); }
public async Task <ContentResult> Sitemap(string category) { try { logger.LogInformation("Generating Sitemap"); var sitemapUrlPrefix = $"{Request.GetBaseAddress()}"; var sitemap = new Sitemap(); // add the defaults sitemap.Add(new SitemapLocation { Url = $"{sitemapUrlPrefix}{category}", Priority = 1, }); var contentPageModels = await contentPageService.GetAllAsync(category).ConfigureAwait(false); if (contentPageModels != null) { var contentPageModelsList = contentPageModels.ToList(); if (contentPageModelsList.Any()) { var sitemapcontentPageModels = contentPageModelsList .Where(w => w.IncludeInSitemap && !w.CanonicalName.Equals(w.Category, StringComparison.OrdinalIgnoreCase)) .OrderBy(o => o.CanonicalName); foreach (var contentPageModel in sitemapcontentPageModels) { sitemap.Add(new SitemapLocation { Url = $"{sitemapUrlPrefix}{contentPageModel.Category}/{contentPageModel.CanonicalName}", Priority = 1, }); } } } // extract the sitemap var xmlString = sitemap.WriteSitemapToString(); logger.LogInformation("Generated Sitemap"); return(Content(xmlString, MediaTypeNames.Application.Xml)); } catch (Exception ex) { logger.LogError(ex, $"{nameof(Sitemap)}: {ex.Message}"); } return(null); }
public async Task <ContentResult?> Sitemap() { try { logger.LogInformation("Generating Sitemap"); var sitemapUrlPrefix = $"{Request.GetBaseAddress()}{PagesController.RegistrationPath}/"; var sitemap = new Sitemap(); // add the defaults sitemap.Add(new SitemapLocation { Url = $"{sitemapUrlPrefix}", Priority = 1, }); var contentPageModels = await contentPageService.GetAllAsync().ConfigureAwait(false); if (contentPageModels != null) { var contentPageModelsList = contentPageModels.ToList(); if (contentPageModelsList.Any()) { var sitemapContentPageModels = contentPageModelsList .Where(w => w.IncludeInSitemap.HasValue && w.IncludeInSitemap.Value) .OrderBy(o => o.CanonicalName); foreach (var contentPageModel in sitemapContentPageModels) { sitemap.Add(new SitemapLocation { Url = $"{sitemapUrlPrefix}{contentPageModel.CanonicalName}", Priority = 1, }); } } } // extract the sitemap var xmlString = sitemap.WriteSitemapToString(); logger.LogInformation("Generated Sitemap"); return(Content(xmlString, MediaTypeNames.Application.Xml)); } catch (Exception ex) { logger.LogError(ex, $"{nameof(Sitemap)}: {ex.Message}"); } return(default);
public IActionResult Sitemap() { logger.LogInformation("Generating Sitemap"); var sitemapUrlPrefix = $"{Request.GetBaseAddress()}{BasePagesController<PagesController>.RegistrationPath}"; var sitemap = new Sitemap(); // add the defaults sitemap.Add(new SitemapLocation { Url = sitemapUrlPrefix, Priority = 1, }); if (!sitemap.Locations.Any()) { return(NoContent()); } var xmlString = sitemap.WriteSitemapToString(); logger.LogInformation("Generated Sitemap"); return(Content(xmlString, MediaTypeNames.Application.Xml)); }
public async Task <ActionResult <string> > Sitemap() { var sitemap = new Sitemap { new Url { ChangeFrequency = ChangeFrequency.Daily, Location = Request.Scheme + "://" + Request.Host.Value, Priority = 0.5, TimeStamp = DateTime.Now }, }; foreach (var article in (await _articles.GetAllAsync()).Where(x => !x.IsDraft && !x.Unlisted)) { sitemap.Add(new Url() { ChangeFrequency = ChangeFrequency.Daily, Location = _urlHelper.Action(article.Slug, "article", null, Request.Scheme), Priority = 0.5, TimeStamp = DateTime.Now }); } return(sitemap.ToXml()); }
public Sitemap CreateSitemap(Func <CmsPage, string> generateEntryUrl, string homePage) { IEnumerable <CmsPage> entries = pageData.LoadAllPublished(); int defaultPageId = settingData.Get(Constant.Settings.DefaultPageId).GetIntValue(); var sitemap = new Sitemap(); foreach (CmsPage page in entries) { if (IsDefaultPage(page, defaultPageId)) { AddHomePage(sitemap, page, homePage); continue; } var url = new SitemapUrl(); url.Location = generateEntryUrl(page); url.ChangeFrequency = CalculateFrequency(page.ModifiedAt); url.Priority = 0.7; url.LastModified = page.ModifiedAt.ToString(); sitemap.Add(url); } return(sitemap); }
public Sitemap CreateSitemap(Func<CmsPage, string> generateEntryUrl, string homePage) { IEnumerable<CmsPage> entries = pageData.LoadAllPublished(); int defaultPageId = settingData.Get(Constant.Settings.DefaultPageId).GetIntValue(); var sitemap = new Sitemap(); foreach (CmsPage page in entries) { if (IsDefaultPage(page, defaultPageId)) { AddHomePage(sitemap, page, homePage); continue; } var url = new SitemapUrl(); url.Location = generateEntryUrl(page); url.ChangeFrequency = CalculateFrequency(page.ModifiedAt); url.Priority = 0.7; url.LastModified = page.ModifiedAt.ToString(); sitemap.Add(url); } return sitemap; }
private void GeneratePostSitemap() { Sitemap map = new Sitemap(); string outputPath = string.Format(@"{0}\post-sitemap.xml", _sitemapOutputPath); foreach (var post in BlogContextManager.PostSummaries.Where(p => p.IsActive == true)) { SitemapLocation location = new SitemapLocation() { Url = string.Format("{0}/{1}", _domain, post.StaticHtml), LastModified = DateTime.Now }; if (post.Images != null) { foreach (var image in post.Images) { location.Images.Add(new SitemapImage() { Location = string.Format("{0}/{1}", _domain, image.Url) }); } } map.Add(location); } map.WriteSitemapToFile(outputPath); }
//[OutputCache(Duration = 3600)] public ActionResult Sitemap(RenderModel model, string xml) { if (!string.IsNullOrWhiteSpace(xml)) { var sitemap = new Sitemap(); var root = typedPublishedContentQuery.TypedContentAtRoot().FirstOrDefault(); var contentItems = new List <IPublishedContent>(); contentItems.Add(root); foreach (var child in root.Descendants()) { contentItems.Add(child); if (child.Descendants().Any()) { } contentItems = contentItems.Concat(child.Descendants()).ToList(); } foreach (var content in contentItems.Where(x => x.IsVisible())) { sitemap.Add(new Url { ChangeFrequency = ChangeFrequency.Daily, Location = content.UrlAbsolute(), Priority = 0.5, TimeStamp = content.CreateDate }); } return(this.Content(sitemap.ToXml(), "text/xml")); } else { return(this.CurrentTemplate(model)); } }
public ActionResult SiteMapXml() { string domain = Request.Url.Host; Sitemap sitemap = new Sitemap(); using (ContentRepository content_repository = new ContentRepository()) { long totals; foreach (var item in content_repository.GetActive((string[])null, null, null, null, 1, Int64.MaxValue, out totals, "content_in_sitemap = true", null, domain)) { sitemap.Add(new Location() { Url = string.Format("http://{0}{1}", Request.Url.Host, item.content_url) }); } } XmlSerializer xs = new XmlSerializer(typeof(Sitemap)); MemoryStream ms = new MemoryStream(); XmlTextWriter xw = new XmlTextWriter(ms, Encoding.UTF8); xs.Serialize(xw, sitemap); ms.Position = 0; return(File(ms, "text/xml")); }
public void WriteTest() { string filename = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "sitemap.xml"); Console.WriteLine(filename); Sitemap target = new Sitemap(filename); List <MapImage> images = new List <MapImage>(); images.Add(new MapImage { Caption = "logo", Loc = @"http://www.google.com.hk/intl/zh-CN/images/logo_cn.png", }); target.Add(new SitemapUrl { Loc = @"http://www.google.com", ChangeFreq = ChangeFrequency.Daily, LastModifiedDateTime = DateTime.Now, Priority = "0.5", MapImages = images }); target.Write(); }
public void AddToSiteMap(Sitemap sm, string url, double?priority, Location.eChangeFrequency frequency) { sm.Add(new Location() { Url = url, LastModified = DateTime.UtcNow, Priority = priority, ChangeFrequency = frequency }); }
protected Sitemap GetGoogleSitemap() { Sitemap sitemap = new Sitemap(); foreach (Uri uri in UriList) { sitemap.Add(getLocationFromUri(uri)); } return(sitemap); }
public void AddToSiteMap(Sitemap sm, string url, double?priority, Location.eChangeFrequency frequency, DateTime dt) { sm.Add(new Location() { // Url = string.Format("http://www.TechnoDesign.ir/Articles/{0}/{1}", 1, "SEO-in-ASP.NET-MVC"), Url = url, LastModified = dt.ToUniversalTime(), Priority = priority, ChangeFrequency = frequency }); }
public ContentResult Sitemap() { try { _logger.LogInformation("Generating Sitemap"); const string helpControllerName = "Help"; var sitemap = new Sitemap(); // add the defaults sitemap.Add(new SitemapLocation() { Url = Url.Action(nameof(HelpController.Body), helpControllerName, null, Request.Scheme), Priority = 1 }); sitemap.Add(new SitemapLocation() { Url = Url.Action(nameof(HelpController.InformationSources), helpControllerName, null, Request.Scheme), Priority = 1 }); sitemap.Add(new SitemapLocation() { Url = Url.Action(nameof(HelpController.PrivacyAndCookies), helpControllerName, null, Request.Scheme), Priority = 1 }); sitemap.Add(new SitemapLocation() { Url = Url.Action(nameof(HelpController.TermsAndConditions), helpControllerName, null, Request.Scheme), Priority = 1 }); // extract the sitemap string xmlString = sitemap.WriteSitemapToString(); _logger.LogInformation("Generated Sitemap"); return(Content(xmlString, "application/xml")); } catch (Exception ex) { _logger.LogError(ex, $"{nameof(Sitemap)}: {ex.Message}"); } return(null); }
//action public ActionResult Sitemap1() { var sm = new Sitemap(); sm.Add(new Location() { Url = string.Format("http://www.TechnoDesign.ir/Articles/{0}/{1}", 1, "SEO-in-ASP.NET-MVC"), LastModified = DateTime.UtcNow, Priority = 0.5D }); return(new XmlResult(sm)); }
private Sitemap AppendShellSitemap() { const string homeControllerName = "Home"; var sitemap = new Sitemap(); // output the composite UI site maps sitemap.Add(new SitemapLocation { Url = Url.Action(nameof(HomeController.Index), homeControllerName, null, Request.Scheme), Priority = 1 }); return(sitemap); }
public async Task <ActionResult <string> > GetSiteMapForUser(string userId) { var user = await userManager.FindByIdAsync(userId); if (!user.IsAdmin && !user.IsUnlimited) { var subscription = await functionalUnitOfWork.SubscriptionRepository.GetLatestSubscriptionForUser(user.Id); if (subscription != null && subscription.SubscriptionPackId != Guid.Empty) { var pack = await functionalUnitOfWork.SubscriptionPackRepository.FirstOrDefault(s => s.Id == subscription.SubscriptionPackId); if (subscription != null) { if (pack.Label.ToLower() != "ultimate") { return(BadRequest()); } } } } if (user.SubscriptionEndDate.HasValue && user.SubscriptionEndDate.Value < DateTime.UtcNow) { return(BadRequest()); } var sitemap = new Sitemap { new X.Web.Sitemap.Url { ChangeFrequency = ChangeFrequency.Hourly, Location = $"{configuration["Service:FrontOffice:Url"].TrimEnd('/')}/api/rss/{user.Id}", Priority = 1, LastMod = DateTime.UtcNow.Date.ToString("dd/MM/yyy") } }; var articles = await functionalUnitOfWork.AdRepository.GetVisibledUser(user.Id); foreach (var article in articles) { sitemap.Add(new Url { ChangeFrequency = ChangeFrequency.Daily, Location = $"{configuration["Service:FrontOffice:Url"].TrimEnd('/')}/ads/details/{article.Id}", LastMod = DateTime.UtcNow.Date.ToString("dd/MM/yyy") }); } return(Content(sitemap.ToXml(), "application/xml")); }
public async Task <ActionResult <string> > GetSiteMapGlobal() { var users = await userManager.Users.Where(u => u.IsUnlimited || u.SubscriptionEndDate > DateTime.UtcNow).ToListAsync(); var sitemap = new Sitemap { new X.Web.Sitemap.Url { ChangeFrequency = ChangeFrequency.Hourly, Location = $"{configuration["Service:FrontOffice:Url"].TrimEnd('/')}/api/rss", Priority = 1, LastMod = DateTime.UtcNow.Date.ToString("dd/MM/yyy") } }; foreach (var user in users) { sitemap.Add(new X.Web.Sitemap.Url { ChangeFrequency = ChangeFrequency.Daily, Location = $"{configuration["Service:FrontOffice:Url"].TrimEnd('/')}/viewprofile/{(!string.IsNullOrEmpty(user.PinDigit) ? user.PinDigit : user.Id)}", LastMod = DateTime.UtcNow.Date.ToString("dd/MM/yyy") }); } var articles = await functionalUnitOfWork.AdRepository.GetVisibled(); foreach (var article in articles) { sitemap.Add(new Url { ChangeFrequency = ChangeFrequency.Daily, Location = $"{configuration["Service:FrontOffice:Url"].TrimEnd('/')}/ads/details/{article.Id}", LastMod = DateTime.UtcNow.Date.ToString("dd/MM/yyy") }); } return(Content(sitemap.ToXml(), "application/xml")); }
public void Generates_Sitemap_With_Image() { var url = Url.CreateUrl("https://example.com"); url.AddImage("https://example.com/image1.jpg", "Caption of the image1", "Title of the image1"); url.AddImage("https://example.com/image2.jpg", "Caption of the image2", "Title of the image2"); var sitemap = new Sitemap(); sitemap.Add(url); var result = _sitemapGenerator.GenerateSitemaps(sitemap, new DirectoryInfo("GenerateFullSitemapsTests"), "full_file"); Assert.AreEqual(1, result.Count); }
private static void BuildSiteMap() { var sitemap = new Sitemap(); var JsonFileHelper = new JsonFileHelper(); var allMovies = JsonFileHelper.ReadJsonFile("Data.json"); var movieList = JsonConvert.DeserializeObject <List <AinunuMovieDTO> >(allMovies); var totalpages = movieList.Count / 48; if (movieList.Count % 48 != 0) { totalpages++; } for (int i = 1; i <= totalpages; i++) { sitemap.Add(new Url { Location = baseUrl + i.ToString(), ChangeFrequency = ChangeFrequency.Daily, Priority = 0.5, TimeStamp = DateTime.Now }); } foreach (var movie in movieList) { sitemap.Add(new Url { Location = baseUrl + "content/" + movie.id, ChangeFrequency = ChangeFrequency.Daily, Priority = 0.3, TimeStamp = DateTime.Now }); } JsonFileHelper.WriteJsonFile("sitemap.xml", sitemap.ToXml()); }
public String SiteMap() { /* * Cache = 38 * Vertice = 41 * Nifor = 1043 * Unocero= 37 */ var id = 38; Sitemap sitemap = new Sitemap(); sitemap.Add(new SitemapLocation { ChangeFrequency = SitemapLocation.eChangeFrequency.weekly, Url = "Http://cache.news" }); var getNews = MagazineService.GetNewsByMagazineId(id); foreach (var item in getNews) { sitemap.Add(new SitemapLocation { ChangeFrequency = SitemapLocation.eChangeFrequency.never, Url = "Http://cache.news/noticia/" + item.NewsId + "/" + item.Permalink }); } var getXml = sitemap.WriteSitemapToFile(AppDomain.CurrentDomain.BaseDirectory + "sitemap.xml"); //MUESTRA EN PANTALLA EL XML var doc = XDocument.Load(AppDomain.CurrentDomain.BaseDirectory + "/Content/Sitemaps/" + getNews[0].Category.Magazine.Title + "sitemap.xml"); string encodedXml = HttpUtility.HtmlEncode(doc); return(encodedXml); }
private void GenerateTagSitemap() { Sitemap map = new Sitemap(); string outputPath = string.Format(@"{0}\post_tag-sitemap.xml", _sitemapOutputPath); foreach (var tag in BlogContextManager.Tags) { SitemapLocation location = new SitemapLocation() { Url = string.Format("{0}/tag/{1}", _domain, tag.Name.Replace(" ", "%20")), LastModified = DateTime.Now }; map.Add(location); } map.WriteSitemapToFile(outputPath); }
private void GenerateCategorySitemap() { Sitemap map = new Sitemap(); string outputPath = string.Format(@"{0}\category-sitemap.xml", _sitemapOutputPath); foreach (var category in BlogContextManager.Categories) { SitemapLocation location = new SitemapLocation() { Url = string.Format("{0}/category/{1}", _domain, category.Name.Replace(" ", "%20")), LastModified = DateTime.Now }; map.Add(location); } map.WriteSitemapToFile(outputPath); }
public async Task <ContentResult> Sitemap() { try { logService.LogInformation("Generating Sitemap"); var sitemapUrlPrefix = $"{Request.GetBaseAddress()}{ProfileController.ProfilePathRoot}"; var sitemap = new Sitemap(); var jobProfileModels = await jobProfileService.GetAllAsync().ConfigureAwait(false); if (jobProfileModels != null) { var jobProfileModelsList = jobProfileModels.ToList(); if (jobProfileModelsList.Any()) { var sitemapJobProfileModels = jobProfileModelsList .Where(w => w.IncludeInSitemap) .OrderBy(o => o.CanonicalName); foreach (var jobProfileModel in sitemapJobProfileModels) { sitemap.Add(new SitemapLocation { Url = $"{sitemapUrlPrefix}/{jobProfileModel.CanonicalName}", Priority = 1, }); } } } // extract the sitemap var xmlString = sitemap.WriteSitemapToString(); logService.LogInformation("Generated Sitemap"); return(Content(xmlString, MediaTypeNames.Application.Xml)); } catch (Exception ex) { logService.LogError($"{nameof(Sitemap)}: {ex.Message}"); } return(null); }
protected override void Init() { sitemap = new Sitemap(); sitemap.Add(new SitemapItem() { Id = id_1, }); sitemap[0].Items.Add(new SitemapItem() { Id = id_2 }); sitemap[0].Items.Add(new SitemapItem() { Id = Guid.NewGuid().ToString() }); }
public virtual async Task <ActionResult> Index() { var productsList = await _siteMapService.GetProductsSiteMap(); var sm = new Sitemap(); foreach (var product in productsList) { sm.Add(new Location() { Url = Url.Action(MVC.Product.Home.ActionNames.Index, MVC.Product.Home.Name, new { area = MVC.Product.Name, id = product.Id, title = product.SlugUrl }, Request.Url.Scheme), LastModified = product.LastModified.Date, Priority = 0.5D, ChangeFrequency = Location.EChangeFrequency.Daily }); } return(new SiteMapResult(sm)); }
protected string GenerateXml(ContentItem startItem, Sitemap result = null) { IEnumerable<N2.ContentItem> pages = Find.Items .Where .Parent.Eq(startItem) .And.Published.Le(DateTime.Now) .And.Type.NotEq(typeof(SitemapXml)) // Minimize selection as .And.Type.NotEq(typeof(CustomCssContent)) // much as possible .And.Type.NotEq(typeof(CustomJavaScriptContent)) .And.Type.NotEq(typeof(RedirectPage)) .And.Type.NotEq(typeof(FeedPage)) .And.State.NotEq(ContentState.Deleted) .And.State.NotEq(ContentState.Draft) .And.State.NotEq(ContentState.New) .And.State.NotEq(ContentState.Unpublished) //.And.State.Eq(ContentState.Published) .Select() .Where(item => item.IsPage && SitemapDecorator.AutoDefineOnType(item.GetType()) && !item.GetDetail<bool>(EditModeFields.Syndication.ExcludeFromSiteMapName, false)) .Union(new N2.ContentItem[] { startItem }); result = result ?? new Sitemap(); foreach (N2.ContentItem page in pages) { string url = (page is WebPage) ? ((WebPage)page).CanonicalUrl //TODO: Fully qualify : page.GetSafeUrl(); if (!result.Where(item => item.Loc == url).Any()) { SitemapUrl pageUrl = new SitemapUrl() { LastModifiedDate = page.Updated, Loc = url }; result.Add(pageUrl); } if (page != startItem) GenerateXml(page, result); } return result.ToString(); }