Add and select a custom link provider

Current version: 10.0

With SXA, you can select a different link provider for different sites. This can be useful when you have multiple sites that all have different link requirements. For example, if you want the language in the URL on multilingual sites and not on a single language site. To work with a custom link provider, you can add providers to the linkManager config section.

To add and select a link provider:

  1. Create a new patch file. Make sure to add your own <add/> node to the providers node under the linkManager node and add the code for your custom provider. For example:

    RequestResponse
    <linkManager defaultProvider="switchableLinkProvider">
    <providers>
    <add name="customLinkProvider" type="Sitecore.XA.Foundation.Multisite.LinkManagers.LocalizableLinkProvider, Sitecore.XA.Foundation.Multisite" cacheExpiration="5" addAspxExtension="false" alwaysIncludeServerUrl="false" encodeNames="true" languageEmbedding="always" languageLocation="filePath" shortenUrls="true" useDisplayName="false"/>
    </providers>
    </linkManager>
  2. In the Content Editor, navigate to sitecore/content/<tenant>/<site>/settings/Site Grouping/<site> and in the Basic section, in the Link Provider name field, enter the name of your custom provider.

Do you have some feedback for us?

If you have suggestions for improving this article,