示例#1
0
        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);
        }
示例#2
0
        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);
        }
示例#3
0
        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);
        }
示例#4
0
        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);
        }