/// <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()))); }
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); }
/// <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); }