Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more

Class CanonicalLinkExtensions

Extension methods for rendering Canonical link tags for content.

Inheritance
System.Object
CanonicalLinkExtensions
Namespace: EPiServer.Web.Mvc.Html
Assembly: EPiServer.Cms.AspNetCore.HtmlHelpers.dll
Version: 12.0.3
Syntax
public static class CanonicalLinkExtensions : Object

Methods

Renders a canonical link element for the current context.

Declaration
public static IHtmlContent CanonicalLink(this IHtmlHelper html)
Parameters
Type Name Description
Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper html

The HTML.

Returns
Type Description
Microsoft.AspNetCore.Html.IHtmlContent

A canonical link element with the canonical url for the current context.

Renders a canonical link element for the provided parameters.

Declaration
public static IHtmlContent CanonicalLink(this IHtmlHelper html, ContentReference contentLink, string language, string action)
Parameters
Type Name Description
Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper html

The HTML.

ContentReference contentLink

The content link of the content. If null the current content will be used.

System.String language

The content language. If null the current content language or preferred language will be used.

System.String action

The controller action that should be appended to the url. If null the current action will be used. Use an empty string to remove the current action.

Returns
Type Description
Microsoft.AspNetCore.Html.IHtmlContent

A canonical link element with the canonical url for the provided parameters.