コード例 #1
0
        /// <summary>
        /// Generate all keyword parts
        /// </summary>
        /// <param name="html">HTML helper</param>
        /// <param name="part">Meta keyword part</param>
        /// <returns>Generated string</returns>
        public static IHtmlContent NopMetaKeywords(this IHtmlHelper html, string part = "")
        {
            IPageHeadBuilder pageHeadBuilder = ServiceProviderFactory.ServiceProvider.GetService <IPageHeadBuilder>();

            html.AppendMetaKeywordParts(part);
            return(new HtmlString(html.Encode(pageHeadBuilder.GenerateMetaKeywords())));
        }
コード例 #2
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);
 }
コード例 #3
0
ファイル: LayoutExtensions.cs プロジェクト: sounj142/aaabbb
 /// <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);
 }