Exemplo n.º 1
0
        public MvcHtmlString RenderMetas()
        {
            var metas = resourcesManager.GetRegisteredMetas().ToList();

            if (!metas.Any(x => x.Name.Equals("keywords", StringComparison.InvariantCultureIgnoreCase)))
            {
                metas.Add(new MetaEntry {
                    Name = "keywords", Content = SiteSettings.DefaultMetaKeywords
                });
            }

            if (!metas.Any(x => x.Name.Equals("description", StringComparison.InvariantCultureIgnoreCase)))
            {
                metas.Add(new MetaEntry {
                    Name = "description", Content = SiteSettings.DefaultMetaDescription
                });
            }

            var sb = new StringBuilder();

            foreach (var meta in metas)
            {
                sb.Append(meta);
            }
            return(new MvcHtmlString(sb.ToString()));
        }
Exemplo n.º 2
0
        public MvcHtmlString RenderMetas()
        {
            var metas = resourcesManager.GetRegisteredMetas();

            if (metas.Count == 0)
            {
                return(null);
            }

            var sb = new StringBuilder();

            foreach (var meta in metas)
            {
                sb.Append(meta);
            }
            return(new MvcHtmlString(sb.ToString()));
        }