Does this scenario sound familiar?
- Sitecore CM/CD are on different servers
- Developer doesn’t have access to the CD server that is currently showing an error in the browser.
- Code base for both CM and CD are the same.
- Developer switches the database from Master to Web in CM and then previews the page but no error is shown on the page or in the logs.
- Client has to wait until access can be given to the developer to investigate the issue
What if there was a better way?
How can I reproduce this issue?
I recommend that you download and install Sitecore Extensions but it is not required in order to reproduce the issue.
- Click on this link and then scroll all the way to the bottom to download the zip file based on the browser where you want to install it.
Now that Sitecore Extensions is installed let’s make the following changes.
- Find the Sitecore Extenisions button (see screenshot below) and click “Options
- Go to Modules > Database color
- Click on the “Color Mapping” tab to start adding the Database names and colors.
- Go to /sitecore/content/home
- Under the master database
- Change the Title field value to “Inside Master”
- Under the web database
- Change the Title field value to “Inside Web”
- Screenshot below will show where you can go to change the database in Sitecore
- Under the master database
- Click Publish > Experience Editor under the Master database and you will see something like this below.
- Switch to the web database, click Publish > Experience Editor under the Web database and you will see the exact same thing. Now how do we fix this issue.
How do I make Preview show Web content instead of Master content?
There are 2 ways you can solve this issue
- Add the following url parameter when you are Preview mode (master or web)
-
- &sc_database=web
- It should now look like this below
-
- Use the patch below to change the value of defaultContentDatabaseName from “master” to “web”
-
- Always go with the first option and only use this option if the first one doesn’t seem to be working correctly. Make sure to change it back immediately after you see the preview so you don’t potentially cause other issues.
- defaultContentDatabaseName is a Sitecore global variable used by the shell site to determine what database to use to show the content.
-
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/"> <sitecore> <sc.variable name="defaultContentDatabaseName" value="web"/> </sitecore> </configuration>
tnx for Page Preview Master/Web Paradox post