Reputation: 566
I have multiple sites architecture. Like this one
sitecore/content/site1
sitecore/content/site2
For each item of site2 referenced in site1 I get the following URL:
www.site1.com/sitecore/content/site2/item
instead of
I've debugged Sitecore.Sites.DefaultItemSiteResolver and found, that the site can be only resolved only if it has "Enable Preview" site property set to true:
But now, after setting it to true, I have another problem, the page resolving now works also in the preview (which is not the desired behavior, I want only the "webiste" site to be resolved there). It even ignores the "Preview.ResolveSite" setting, which is set to false.
What am I doing wrong? How to enable site resolving for published sites but not for the preview?
Upvotes: 2
Views: 1308
Reputation: 3283
There are several settings in Sitecore.config
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.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
.
Upvotes: 2