Sitecore’s fundamental architecture is full of features that allow editors to create content and review it before the content is promoted to a public-facing website. This can be accomplished using built-in preview tools or by publishing content to non-public preview websites. Though these options exist, they may be time-consuming to setup or costly to setup (i.e. for licensing reasons). One approach that I will explain it to setup a “poor man’s staging solution” that uses the existing Sitecore instance to show master database content before it is published. Lets get into the details.
First, let’s re-cap basic publishing. Content editors make changes to content items in the master database. They can use the preview ribbon to open a preview of the content in the actual site. When the content is to be made live, they publish the content to the web database (by default, named as the Internet publishing target). This is all great, but what if you want someone to review content before its published and they cannot access Sitecore (meaning they can’t use Preview mode)? Well, that’s where the “poor man’s staging solution” comes in.
Configure a Preview Site
The concept is quite simple to setup a preview URL:
- Determine a (sub)domain for preview (e.g. preview.mysite.com) and setup DNS as needed
- Add the preview host to the existing IIS Sitecore instance
- Add a new
<site>node to the Sitecore instance’s
- Set the new site to listen to the master database
For demo purposes, I will use the host
preview.mysite.com as our example. So the primary thing we need to do is to create a new
<site> node above the standard “website” node. Here’s an example:
<site name="website_preview" filterItems="false" enableWorkflow="true" hostName="preview.mysite.com" virtualFolder="/" physicalFolder="/" rootPath="/sitecore/content" startItem="/home" database="master" domain="extranet" allowDebug="true" cacheHtml="true" htmlCacheSize="10MB" registryCacheSize="0" viewStateCacheSize="0" xslCacheSize="5MB" filteredItemsCacheSize="2MB" enablePreview="true" enableWebEdit="true" enableDebugger="true" disableClientData="false" />
<site name="website" virtualFolder="/" physicalFolder="/" rootPath="/sitecore/content" startItem="/home" database="web" domain="extranet" allowDebug="true" cacheHtml="true" htmlCacheSize="10MB" registryCacheSize="0" viewStateCacheSize="0" xslCacheSize="5MB" filteredItemsCacheSize="2MB" enablePreview="true" enableWebEdit="true" enableDebugger="true" disableClientData="false" />
There are just a few important attributes on the new preview node that need to be made for this to work:
- Load content from the master database:
- Set a
hostNameto bind to:
- Don’t filter items which preserves some basic item restrictions:
- Enable workflow:
And the best thing is, all of these steps I’ve outlined come directly from Sitecore, so I’m not making anything up: How can i set “Live” Mode on my site?
This solution does have some caveats that need to be considered:
- The HTML output caches need to be manually cleared if you’re modifying cached content and need to preview it. This is because these caches are normally cleared on publish. One possible way to get around this issue is to set the size of the HTML cache for the preview site to 0MB, but I have not tried it.
- If you use Lucene indexes, they will not be updated. This is because you’re indexes are probably indexing web content and get added during publish operations.
Feel free to comment about any other approaches you’ve taken to do something like this.
12 thoughts on “How to Setup a Sitecore Preview Site to Review Content Before Publishing”
I use the same technique pretty regularly, especially since it staves off content editors from pushing content through workflow and only publishing to a CMS preview target, which is a recipe for disaster. Regarding HTML cache, I think you can also just set cacheHtml=”false” in the entry.
Hi. I’ve just read your post, and maybe you know. I would like to experience how to find by search on Google, Yahoo … those blogs that have this option (plug-in) active as Preview Comments. How can I do this?
How does user roles and permissions work witht his approach?
Does links to other content properly work with this?
Thanks in advance and keep up the good work.
Great article! We will be linking to this great
content on our site. Keep up the good writing.
Very good article written on Sitecore Preview Site.
Nice post. Thanks for sharing your insights and conclusions with us.
superb listing thanks a lot for share with us
Great Man, Thanks, Really Good
Hello I am using same method but not able to do it, Do you help me on mentioned URL in website
Great article! Thnaks man