/// <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); }
/// <summary> /// Append canonical URL element to the <![CDATA[<head>]]> /// </summary> /// <param name="html">HTML helper</param> /// <param name="part">Canonical URL part</param> public static void AppendCanonicalUrlParts(this IHtmlHelper html, string part) { IPageHeadBuilder pageHeadBuilder = ServiceProviderFactory.ServiceProvider.GetService <IPageHeadBuilder>(); pageHeadBuilder.AppendCanonicalUrlParts(part); }
/// <summary> /// Append canonical URL element to the <![CDATA[<head>]]> /// </summary> /// <param name="html">HTML helper</param> /// <param name="part">Canonical URL part</param> /// <param name="pageHeadBuilder"></param> public static void AppendCanonicalUrlParts(this HtmlHelper html, string part, IPageHeadBuilder pageHeadBuilder = null) { if (pageHeadBuilder == null) pageHeadBuilder = EngineContext.Current.Resolve<IPageHeadBuilder>(); pageHeadBuilder.AppendCanonicalUrlParts(part); }