Resolving issue with page preview in Sitecore multisite configuration

With Sitecore multisite solution and architecture, we see site resolving logic might seem to work in unexpected ways sometime,and i encountered this issue couple of weeks back, here are few things to consider with Sitecore multisite configuration.

Let’s assume we have two sites in the same Sitecore instance, this is how the typical structure looks like:

pagepreview

In order to have two sites in the same Sitecore instance, we also need to add site node settings which is present as part of Sitecore.config now,this is how it looks:

<site name=”website” enableTracking=”true” virtualFolder=”/” physicalFolder=”/” rootPath=”/sitecore/content” startItem=”/home” database=”web” domain=”extranet” allowDebug=”true” cacheHtml=”true” htmlCacheSize=”50MB” registryCacheSize=”0″ viewStateCacheSize=”0″ xslCacheSize=”25MB” filteredItemsCacheSize=”10MB” enablePreview=”true” enableWebEdit=”true” enableDebugger=”true” disableClientData=”false” cacheRenderingParameters=”true” renderingParametersCacheSize=”10MB” />

<site name=”my-new-site”…../>

<site name=”website”….> is the default setting that comes with Sitecore, we need to add any new site added to system here, so that site can be resolved, in this example we added “my-new-site” to the list.

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.
Here, the Experience Editor and Preview mode are opened in the context of the site defined in the Preview.DefaultSite setting.

In my case, I observed the page preview mode was throwing error, and when i looked into the “Preview.Default” setting in Sitecore.config file, it was pointing to “website
We had “website” site node , but the location was no longer exists- it was pointing to /sitecore/content/home and we didn’t had any item in this location.

So, there are two options here to resolve this issue:

  1. Update the “website” site node start item in Sitecore.config to point to active site/ location or
  2. Update “Preview.DefaultSite” mode settings with an active site.

Note: Please make any updates to Sitecore.config using Sitecore patch file, so that we don’t mess up anything with the default configurations, and down the line didn’t face any issue with Sitecore upgrade as well.

Also, to make sure that items are opened in context of correct site, we must set the Rendering.SiteResolvingMatchCurrentSite setting to “true”

All configs related to site resolving can be found (“/App_Config/Sitecore.config” in Sitecore 8.x and web.config in 7.x)

Please read more about the site resolving here- https://kb.sitecore.net/articles/986056

Happy learning 🙂

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s