Example #1
0
        private static IEnumerable <string> GetDirectives(PageSearchEngineDirectives model)
        {
            var directives = new List <string>();

            var site = Sitecore.Context.Site.SiteInfo;

            var overrides = site.GetRobotsMetatagOverride();

            if (!string.IsNullOrEmpty(overrides))
            {
                directives.Add(overrides);
                return(directives);
            }


            if (model.SearchEngineIndexesPage)
            {
                directives.Add("index");
            }
            else
            {
                directives.Add("noindex");
            }

            if (model.SearchEngineFollowsLinks)
            {
                directives.Add("follow");
            }
            else
            {
                directives.Add("nofollow");
            }

            if (!model.SearchEngineIndexesImages)
            {
                directives.Add("noimageindex");
            }

            if (!model.SearchEngineCanCachePage)
            {
                directives.Add("noarchive");
                directives.Add("nocache");
            }

            if (!model.SearchEngineCanSnippetPage)
            {
                directives.Add("nosnippet");
            }

            if (!model.AllowODPSnippet)
            {
                directives.Add("noodp");
            }

            return(directives);
        }
Example #2
0
        private static IEnumerable <string> GetDirectives(PageSearchEngineDirectives model)
        {
            var directives = new List <string>();

            if (model.SearchEngineIndexesPage)
            {
                directives.Add("index");
            }
            else
            {
                directives.Add("noindex");
            }

            if (model.SearchEngineFollowsLinks)
            {
                directives.Add("follow");
            }
            else
            {
                directives.Add("nofollow");
            }

            if (!model.SearchEngineIndexesImages)
            {
                directives.Add("noimageindex");
            }

            if (!model.SearchEngineCanCachePage)
            {
                directives.Add("noarchive");
                directives.Add("nocache");
            }

            if (!model.SearchEngineCanSnippetPage)
            {
                directives.Add("nosnippet");
            }

            if (!model.AllowODPSnippet)
            {
                directives.Add("noodp");
            }

            return(directives);
        }