Configuring site resolving logic in Sitecore

  • This article describes configuration settings related to site resolving functionality, and some scenarios related to the Preview and Editing mode, when they are relevant.

    Sometimes the site resolving logic might seem to work in unexpected ways (for example, when opening items in the Experience Editor or in Preview mode), but, in fact, the behavior is affected by special configuration settings that can be changed according to your requirements.

    There are several settings that help to configure proper site resolving logic in multisite Sitecore solutions:

    • Rendering.SiteResolving — enables site resolving, so cross-site links can be rendered with correct hostname, language, and virtual folder.
    • Rendering.SiteResolvingMatchCurrentSite — item location is taken into consideration when a cross-site link is built. All items under a certain site root will be resolved in the context of that root.
    • Rendering.SiteResolvingMatchCurrentLanguage — when true, context language is taken into consideration when a cross-site link is built.

    A detailed description of each setting can be found in the configuration files (/App_Config/Sitecore.config in Sitecore XP 8.x and /Web.config in 7.x).

  • In general, it is recommended to keep the Rendering.SiteResolving setting value at "true" for any multisite solution in order to ensure that cross-site links are built with the correct parameters. In this case, the Experience Editor and Preview mode are opened in the context of the site defined in the Preview.DefaultSite setting, if no other site can be resolved.

    To make sure that items are opened in context of correct site, you must set the Rendering.SiteResolvingMatchCurrentSite setting to "true".

    There also might be a case when the Rendering.SiteResolvingMatchCurrentLanguage setting is set to "true", and some specific site definition node (located under the <sites> node) has a language parameter. In this scenario, if a user opens the Experience Editor or the Preview mode, the site is resolved according to the said language parameter. For example, there are two sites configured, with "site" and "altSite" names. The Preview.DefaultSite setting value is "site" and the "altSite" node has a "language" parameter with "de" value. In this case, the following scenarios are possible:

    • The user opens the "de" version of an item under the "altSite" root. The site will be resolved as "altSite".
    • The user opens the "en" version of an item under the "altSite" root. The site will be resolved as "site".

    To avoid such behavior, the Rendering.SiteResolvingMatchCurrentLanguage can be set to "false". Overall, in most cases, this setting can be set to "false", unless several site definitions differ only by the language parameter. For example, there are two sites, which use the same items and the same site roots, but different hostnames (uk.hostname and de.hostname). In this case, site resolving would be language-sensitive and the LinkProvider will take language into consideration and, therefore, the setting should be set to "true".

Applies to:

CMS 7.2+

December 30, 2016
January 03, 2017

Keywords: 

  • CMS