public ISitemap CreateSitemap(Func <IEntry, string> generateEntryUrl, string homePage) { ICollection <IEntry> entries = this.daoFactory.EntryDao.LoadAll(); int homePageId = Convert.ToInt32(this.daoFactory.SiteDao.LoadAttributes().GetValue(Constant.Settings.DefaultPageId)); ISitemap sitemap = this.domainObjectFactory.CreateSitemap(); foreach (IEntry page in entries) { if (this.IsDefaultPage(page, homePageId)) { this.AddHomePage(sitemap, page, homePage); continue; } ISitemapUrl url = this.domainObjectFactory.CreateSitemapUrl(); 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 AddHomePage(ISitemap sitemap, IEntry page, string homePage) { ISitemapUrl url = this.domainObjectFactory.CreateSitemapUrl(); url.Location = homePage; url.ChangeFrequency = CalculateFrequency(page.ModifiedAt); url.Priority = 0.9; url.LastModified = page.ModifiedAt.ToString(); sitemap.Insert(0, url); }