Exemplo n.º 1
0
 public override Task ProcessAsync(TagHelperContext context, TagHelperOutput output)
 {
     if (!string.IsNullOrEmpty(Attribute))
     {
         _pageHeadBuilder.AppendMetaKeywordParts(Attribute);
     }
     output.TagName = "meta";
     output.Attributes.Add("name", "keywords");
     output.Attributes.Add("content", _pageHeadBuilder.GenerateMetaKeywords());
     return(Task.CompletedTask);
 }
Exemplo n.º 2
0
        /// <summary>
        /// Append meta keyword element to the <![CDATA[<head>]]>
        /// </summary>
        /// <param name="html">HTML helper</param>
        /// <param name="part">Meta keyword part</param>
        public static void AppendMetaKeywordParts(this IHtmlHelper html, string part)
        {
            IPageHeadBuilder pageHeadBuilder = ServiceProviderFactory.ServiceProvider.GetService <IPageHeadBuilder>();

            pageHeadBuilder.AppendMetaKeywordParts(part);
        }
Exemplo n.º 3
0
 /// <summary>
 /// Generate all keyword parts
 /// </summary>
 /// <param name="html">HTML helper</param>
 /// <param name="pageHeadBuilder"></param>
 /// <param name="part">Meta keyword part</param>
 /// <returns>Generated string</returns>
 public static MvcHtmlString NopMetaKeywords(this HtmlHelper html, IPageHeadBuilder pageHeadBuilder = null,
     string part = null)
 {
     if (pageHeadBuilder == null)
         pageHeadBuilder = EngineContext.Current.Resolve<IPageHeadBuilder>();
     pageHeadBuilder.AppendMetaKeywordParts(part);
     string content = html.Encode(pageHeadBuilder.GenerateMetaKeywords());
     return MvcHtmlString.Create(content);
 }
Exemplo n.º 4
0
 /// <summary>
 /// Append meta keyword element to the <![CDATA[<head>]]>
 /// </summary>
 /// <param name="html">HTML helper</param>
 /// <param name="part">Meta keyword part</param>
 /// <param name="pageHeadBuilder"></param>
 public static void AppendMetaKeywordParts(this HtmlHelper html, string part,
     IPageHeadBuilder pageHeadBuilder = null)
 {
     if (pageHeadBuilder == null)
         pageHeadBuilder = EngineContext.Current.Resolve<IPageHeadBuilder>();
     pageHeadBuilder.AppendMetaKeywordParts(part);
 }