How to setup your site in “Live” Mode
How can I review my site even before publishing (i.e. just after saving)?
How can I preview items in workflow before they are approved?
This is one of the basic requirements for the content editors to review the site just after they have saved the item/page and before publishing it to web.
The Solution no.1
Override GetMediaUrl in MediaProvider
public class MediaProvider : global::Sitecore.Resources.Media.MediaProvider
public override string GetMediaUrl(MediaItem item, MediaUrlOptions options)
var retUrl = base.GetMediaUrl(item, options);
var query = System.Web.HttpContext.Current.Request.QueryString;
if (query[“sc_mode”] != null)
return retUrl + “&sc_mode=” + query[“sc_mode”];
Update the mediaProvider section in config
<mediaProvider type=”NaeemSpace.CustomMediaProviders.MediaProvider, NaeemSpace.CustomMediaProviders” patch:instead=”mediaProvider[@type=’Sitecore.Resources.Media.MediaProvider, Sitecore.Kernel’]”/>
and ensure the setting “Preview Publishing target” is checked for the preview publishing target. This will ensure that the workflow items not in the final workflow can be published in the preview website and the querystring “sc_mode=preview” will ensure that you are viewing the item from preview database.
The Solution no 2:
Sitecore provides an out of box functionality to accomplish this.
You need to setup a “review” website with some proper filters so that you can review our changes before publish or even if your workflow items are not approved state.
“Review” site/mode is also called as “Live” Mode (purely meaning that you are not live but are viewing the site as if it is live.
In the review site the items are visible as soon as you save the item.
To your ‘<Sites>’ config uration section add a review site
<site name=”preview_website” hostName=”preview.website.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” filterItems=”false” enableWorkflow=”true” />
database=”master” will ensure that the contents are loaded from master website
filterItems=”false” will ensure that’s items are not filtered
enableWorkflow=”true” will ensure that it will manage workflow items too.
Yes this functionality comes up with following restrictions or a caveat
- It will display only “publishable” items. ( I will not call it as a caveat as the site respects any publishing restrictions including workflow status, item and version visibility)
- Caching Implications/Restrictions – the live site can’t cache rendering outputs and controls. So you need to clear up the cache as you view the site and
any search indexes pointing to web might not work.