private string GetExternalUrl(Page page) { if (page.Metadata == null || page.MetadataSchema == null) { return(null); } var meta = new ItemFields(page.Metadata, page.MetadataSchema); //Get the Embedded navigation Metadata var url = meta.Text("ExternalUrl"); return(url); }
private string GetNavigationType() { var page = GetPage(); if (page.Metadata == null || page.MetadataSchema == null) { return(null); } var metaFields = new ItemFields(page.Metadata, page.MetadataSchema); var navigationType = metaFields.Text("navigationType"); return(navigationType); }
private bool ValidateNavigationKeywordsMetadata(Page page) { //If page is Index.aspx and it is in the root SG. if (page.OrganizationalItem.Title.Equals(publication.RootStructureGroup.Title) && GetPageName(page.PublishLocationUrl).ToLower().Equals(DefaultPage)) { return(true); } bool result = false; // if (page.Metadata == null || page.MetadataSchema == null) { Logger.Info(string.Format("Page {0} removed from navigation, this page does not have metadata.", page.Title)); return(result); } var meta = new ItemFields(page.Metadata, page.MetadataSchema); var values = meta.Texts("NavigationKeywords"); switch (_navigationType) { case NavigationTop: result = values.Contains(AddToTopNavigationKeyword); break; case NavigationBreadscrum: result = !values.Contains(RemoveFromBreadcrumbKeyword); break; } //For External PAges if (!result) { var externalUrl = meta.Text("ExternalUrl"); result = !string.IsNullOrEmpty(externalUrl); } if (!result) { Logger.Info(string.Format("Page {0} excluded from {1} Navigation", page.PublishLocationUrl, _navigationType)); } return(result); }
private string GetFriendlyPageUrl(RepositoryLocalObject current) { //Only for pages if (current is StructureGroup) { return(null); } if (current.Metadata == null || current.MetadataSchema == null) { return(null); } var meta = new ItemFields(current.Metadata, current.MetadataSchema); //Get the Embedded navigation Metadata var friendlyUrl = meta.Text("SEOUrl"); return(!string.IsNullOrEmpty(friendlyUrl) ? friendlyUrl : null); }