Use the Sitecore LinkManager to Resolve URIs

This page explains how to use the Sitecore LinkManager to resolve search result URIs in a Coveo-Powered Search Page.

What’s the LinkManager

The LinkManager is a module of Sitecore used to resolve URIs. For example, you may only want to display relative URIs, or add the current item language to its URI. The LinkManager is particularly useful in a multisite configuration, where an item can be accessed via different URIs that seem completely unrelated to each other.

For example, if, in your Content Tree, under the Content node, you have the following structure:

And if your Sites node in your Web.config file looks like this:

<site name="mysite1" hostName="www.mysite1.ca" virtualFolder="/" physicalFolder="/" rootPath="/sitecore/content" startItem="/mysite1" language="en" database="web" domain="extranet" enableWebEdit="true" />
<site name="mysite2" hostName="www.mysite2.ca" virtualFolder="/" physicalFolder="/" rootPath="/sitecore/content" startItem="/mysite2" language="en" database="web" domain="extranet" enableWebEdit="true" />

Given the above configuration, the required IIS bindings, and a properly configured hosts file, it’s possible to access the page1 item via the URI www.mysite1.ca/page1 and the page2 item via the URI www.mysite2.ca/page2. This would also allow you to access the page2 item with the following URI: www.mysite1.ca/mysite2/page2.

The ResolveResultClickableUriProcessor

On a Coveo-Powered Search Page, the Sitecore LinkManager configures your URIs. This configuration is allowed through the ResolveResultClickableUriProcessor processor, which you can find in your Coveo.SearchProvider.Rest.config file.

You’re discouraged from modifying the Coveo.SearchProvider.Rest.config file directly. You should instead implement your modifications in the Coveo.SearchProvider.Rest.Custom.config file, to prevent unforeseen upgrade issues.

<coveoProcessParsedRestResponse>
  <processor type="Coveo.SearchProvider.Rest.Processors.CoveoProcessParsedRestResponse.ResolveResultClickableUriProcessor, Coveo.SearchProvider.Rest" />
</coveoProcessParsedRestResponse>

This processor uses the following fields: syssource and uri. If you plan on removing one of these fields, insert your processor after this one.

Configuring the LinkManager

  1. Configure the <sites> node of the Sitecore configuration.
  2. Change the Sitecore site resolving settings, if necessary. Look for the nodes named Rendering.SiteResolving, Rendering.SiteResolvingMatchCurrentLanguage, and Rendering.SiteResolvingMatchCurrentSite in the <settings> node of the Sitecore configuration. Explanations for each setting are provided in the configuration file.

    For versions of Sitecore up to Sitecore 8.0 inclusively, these configurations are located in the Web.config file. For Sitecore 8.1 and later, these configurations are located in the Sitecore.config file and should only be changed using a patch file.

  3. Configure the format of URIs that are to be resolved in the <linkManager> section of the Web.config file (for versions up to Sitecore 8.0 inclusively) or the Sitecore.config file (for Sitecore 8.1 and later).

See Sitecore LinkManager – Multi-site configuration to learn more on this matter.

What's Next for Me?