private SitemapItem GenerateStructureGroupNavigation(StructureGroup startPoint) { SitemapItem root = GenerateFolderNode(startPoint); IEnumerable <XElement> orderedDocument = GetItemsInFolderAsAList(startPoint); foreach (XElement pgNode in orderedDocument) { Page page = Engine.GetObject(pgNode.Attribute("ID").Value) as Page; if (page != null) { if (IsPublished(page) && !IsSystem(pgNode.Attribute("Title").Value)) { root.Items.Add(GeneratePageNode(page)); } } else { if (!IsSystem(pgNode.Attribute("Title").Value)) { root.Items.Add(GenerateStructureGroupNavigation(Engine.GetObject(pgNode.Attribute("ID").Value) as StructureGroup)); } } } return(root); }
public override void Transform(Engine engine, Package package) { Initialize(engine, package); _config = GetNavigationConfiguration(GetComponent()); SitemapItem sitemap = GenerateStructureGroupNavigation(Publication.RootStructureGroup); string sitemapJson = JsonSerialize(sitemap, IsPreview); package.PushItem(Package.OutputName, package.CreateStringItem(ContentType.Text, sitemapJson)); }
private SitemapItem GenerateFolderNode(StructureGroup startPoint) { SitemapItem root = new SitemapItem(GetNavigationTitle(startPoint)) { Id = startPoint.Id, Url = GetUrl(startPoint), Type = ItemType.StructureGroup.ToString(), Visible = IsVisible(startPoint.Title) }; return(root); }
private SitemapItem GeneratePageNode(Page page) { SitemapItem sitemapItem = new SitemapItem(GetNavigationTitle(page)) { Id = page.Id, Url = GetUrl(page), Type = ItemType.Page.ToString(), PublishedDate = GetPublishedDate(page, Engine.PublishingContext.PublicationTarget), Visible = IsVisible(page.Title) }; return(sitemapItem); }
private SitemapItem GenerateStructureGroupNavigation(StructureGroup structureGroup) { SitemapItem result = new SitemapItem { Id = structureGroup.Id, Title = GetNavigationTitle(structureGroup), Url = System.Web.HttpUtility.UrlDecode(structureGroup.PublishLocationUrl), Type = ItemType.StructureGroup.ToString(), Visible = IsVisible(structureGroup.Title) }; foreach (RepositoryLocalObject item in structureGroup.GetItems().Where(i => !i.Title.StartsWith("_")).OrderBy(i => i.Title)) { SitemapItem childSitemapItem; Page page = item as Page; if (page != null) { if (!IsPublished(page)) { continue; } childSitemapItem = new SitemapItem { Id = page.Id, Title = GetNavigationTitle(page), Url = GetUrl(page), Type = ItemType.Page.ToString(), PublishedDate = GetPublishedDate(page, Engine.PublishingContext.TargetType), Visible = IsVisible(page.Title) }; } else { childSitemapItem = GenerateStructureGroupNavigation((StructureGroup)item); } result.Items.Add(childSitemapItem); } return(result); }
private SitemapItem GeneratePageNode(Page page) { SitemapItem sitemapItem = new SitemapItem(GetNavigationTitle(page)) { Id = page.Id, Url = GetUrl(page), Type = ItemType.Page.ToString(), PublishedDate = GetPublishedDate(page, Engine.PublishingContext.PublicationTarget), Visible = IsVisible(page.Title) }; return sitemapItem; }
private SitemapItem GenerateFolderNode(StructureGroup startPoint) { SitemapItem root = new SitemapItem(GetNavigationTitle(startPoint)) { Id = startPoint.Id, Url = GetUrl(startPoint), Type = ItemType.StructureGroup.ToString(), Visible = IsVisible(startPoint.Title) }; return root; }
private SitemapItem GenerateStructureGroupNavigation(StructureGroup structureGroup) { SitemapItem result = new SitemapItem { Id = structureGroup.Id, Title = GetNavigationTitle(structureGroup), Url = System.Web.HttpUtility.UrlDecode(structureGroup.PublishLocationUrl), Type = ItemType.StructureGroup.ToString(), Visible = IsVisible(structureGroup.Title) }; foreach (RepositoryLocalObject item in structureGroup.GetItems().Where(i => !i.Title.StartsWith("_")).OrderBy(i => i.Title)) { SitemapItem childSitemapItem; Page page = item as Page; if (page != null) { if (!IsPublished(page)) { continue; } childSitemapItem = new SitemapItem { Id = page.Id, Title = GetNavigationTitle(page), Url = GetUrl(page), Type = ItemType.Page.ToString(), PublishedDate = GetPublishedDate(page, Engine.PublishingContext.TargetType), Visible = IsVisible(page.Title) }; } else { childSitemapItem = GenerateStructureGroupNavigation((StructureGroup) item); } result.Items.Add(childSitemapItem); } return result; }