Example #1
0
        public virtual IHtmlString Meta()
        {
            AggregateHtmlString htmlStrings = new AggregateHtmlString();
            var htmlMeta = this.PageContext.HtmlMeta;

            if (htmlMeta != null)
            {
                if (!string.IsNullOrEmpty(htmlMeta.Canonical))
                {
                    htmlStrings.Add(new HtmlString(string.Format("<link rel=\"canonical\" href=\"{0}\"/>", Kooboo.StringExtensions.StripAllTags(htmlMeta.Canonical))));
                }
                if (!string.IsNullOrEmpty(htmlMeta.Author))
                {
                    htmlStrings.Add(BuildMeta("author", htmlMeta.Author));
                }

                if (!string.IsNullOrEmpty(htmlMeta.Description))
                {
                    htmlStrings.Add(BuildMeta("description", htmlMeta.Description));
                }

                if (!string.IsNullOrEmpty(htmlMeta.Keywords))
                {
                    htmlStrings.Add(BuildMeta("keywords", htmlMeta.Keywords));
                }
                if (htmlMeta.Customs != null)
                {
                    foreach (var item in htmlMeta.Customs)
                    {
                        htmlStrings.Add(BuildMeta(item.Key, item.Value));
                    }
                }
            }
            return(htmlStrings);
        }
        public static IHtmlString Meta(this IFrontHtmlHelper frontHtml)
        {
            AggregateHtmlString htmlStrings = new AggregateHtmlString();
            var htmlMeta = frontHtml.Page_Context.HtmlMeta;

            if (htmlMeta != null)
            {
                if (!string.IsNullOrEmpty(htmlMeta.Canonical))
                {
                    htmlStrings.Add(new HtmlString(string.Format("<link rel=\"canonical\" href=\"{0}\"/>", htmlMeta.Canonical.StripAllTags())));
                }
                if (!string.IsNullOrEmpty(htmlMeta.Author))
                {
                    htmlStrings.Add(BuildMeta("author", htmlMeta.Author));
                }

                if (!string.IsNullOrEmpty(htmlMeta.Description))
                {
                    htmlStrings.Add(BuildMeta("description", htmlMeta.Description));
                }

                if (!string.IsNullOrEmpty(htmlMeta.Keywords))
                {
                    htmlStrings.Add(BuildMeta("keywords", htmlMeta.Keywords));
                }
                if (htmlMeta.Customs != null)
                {
                    foreach (var item in htmlMeta.Customs)
                    {
                        htmlStrings.Add(BuildMeta(item.Key, item.Value));
                    }
                }
            }
            return(htmlStrings);
        }
Example #3
0
        public virtual IHtmlString Meta()
        {
            AggregateHtmlString htmlStrings = new AggregateHtmlString();
            var htmlMeta = this.PageContext.HtmlMeta;
            if (htmlMeta != null)
            {
                if (!string.IsNullOrEmpty(htmlMeta.Canonical))
                {
                    htmlStrings.Add(new HtmlString(string.Format("<link rel=\"canonical\" href=\"{0}\"/>", Kooboo.StringExtensions.StripAllTags(htmlMeta.Canonical))));
                }
                if (!string.IsNullOrEmpty(htmlMeta.Author))
                {
                    htmlStrings.Add(BuildMeta("author", htmlMeta.Author));
                }

                if (!string.IsNullOrEmpty(htmlMeta.Description))
                {
                    htmlStrings.Add(BuildMeta("description", htmlMeta.Description));
                }

                if (!string.IsNullOrEmpty(htmlMeta.Keywords))
                {
                    htmlStrings.Add(BuildMeta("keywords", htmlMeta.Keywords));
                }
                if (htmlMeta.Customs != null)
                {
                    foreach (var item in htmlMeta.Customs)
                    {
                        htmlStrings.Add(BuildMeta(item.Key, item.Value));
                    }
                }
            }
            return htmlStrings;
        }