/// <summary> /// Generate all canonical URL parts /// </summary> /// <param name="html">HTML helper</param> /// <param name="part">Canonical URL part</param> /// <returns>Generated string</returns> public static IHtmlContent NopCanonicalUrls(this IHtmlHelper html, string part = "") { IPageHeadBuilder pageHeadBuilder = ServiceProviderFactory.ServiceProvider.GetService <IPageHeadBuilder>(); html.AppendCanonicalUrlParts(part); return(new HtmlString(pageHeadBuilder.GenerateCanonicalUrls())); }
public override Task ProcessAsync(TagHelperContext context, TagHelperOutput output) { output.SuppressOutput(); output.Content.SetHtmlContent(_pageHeadBuilder.GenerateCanonicalUrls()); return(Task.CompletedTask); }
/// <summary> /// Generate all canonical URL parts /// </summary> /// <param name="html">HTML helper</param> /// <param name="pageHeadBuilder"></param> /// <param name="part">Canonical URL part</param> /// <returns>Generated string</returns> public static MvcHtmlString NopCanonicalUrls(this HtmlHelper html, IPageHeadBuilder pageHeadBuilder = null, string part = null) { if (pageHeadBuilder == null) pageHeadBuilder = EngineContext.Current.Resolve<IPageHeadBuilder>(); pageHeadBuilder.AppendCanonicalUrlParts(part); string content = pageHeadBuilder.GenerateCanonicalUrls(); return MvcHtmlString.Create(content); }