How to Setup a Sitecore Preview Site to Review Content Before Publishing
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.
Publishing Primer
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’sweb.config - 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:
database="master" - Set a
hostNameto bind to:hostName="preview.mysite.com" - Don’t filter items which preserves some basic item restrictions:
filterItems="false" - Enable workflow:
enableWorkflow="true"
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?
Caveats
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.
3 Comments + Add Comment
Got anything to say? Go ahead and leave a comment!
Popular Posts
- Using the DataSource Field with Sitecore Sublayouts
- Tame Your Sitecore Treelists
- Write to a Custom Sitecore Log with log4net
- Sitecore Upgrade Strategy
- Rendering Fully Qualified Sitecore URLs
- Sitecore Admin Pages Explained
- Managing CSS in the Sitecore Media Library
- Use Any() Instead of Count() To See if an IEnumerable Has Any Objects
- Sitecore Front-End Development Best Practices
- Scaling Sitecore Presentation Component Data Sources
Recent Comments
- Performance tuning your Sitecore installation | Agile and ALM: Software development today on A Going Live Checklist for Sitecore Websites
- Imran Saleem on Sitecore Avanced Database Crawler Occasionally Provides Null Results
- Ty Cahill on Sitecore Front-End Development Best Practices
- Sitecore Managed Sites as Virtual Folders | Fire Breaks Ice on Sitecore Item and Field Names
- Krimos on Using the DataSource Field with Sitecore Sublayouts
Sitecore Links
- .Sitecore
- Aboo Bolaky
- Alex Shyba
- Anders Dreyer
- aweber1.0
- Brian Pedersen
- Christopher Wojciech
- Coffee => Coder => Code
- Dev Sitecored²
- Everything Web
- Image0.com blog
- John West
- Learn Sitecore
- Let's do Sitecore
- Mark van Aalst
- Matthew Kenny
- Molten Core
- Project Lifecycle
- Sean Kearney
- Sebastian Patten
- Sitecore Australia
- Sitecore Blog
- Sitecore Climber
- Sitecore Development
- Sitecore Gadgets
- Techphoria414
- The Client View
- The Sitecore Experience
- Web Content Management and Delivery
Archives
- April 2013 (1)
- February 2013 (1)
- January 2013 (1)
- December 2012 (1)
- June 2012 (2)
- May 2012 (2)
- March 2012 (1)
- February 2012 (1)
- January 2012 (5)
- December 2011 (4)
- November 2011 (1)
- July 2011 (1)
- June 2011 (1)
- May 2011 (2)
- March 2011 (6)
- February 2011 (2)
- January 2011 (10)

Posted under:
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?
Great post!!
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.