Wednesday, May 28, 2014

Sitecore less known gems - Live site setup

Case

A web editor has created a large amount of content that is ready to be published. However, in order to get the final 'OK' on this newly created content, he needs to get the buy-in of specific persons in the company.

The default answer here would be to use the Sitecore preview mode or use well devised workflows within sitecore that are automatically notifying the correct group of persons by sending mails or updating their RSS coupling (in outlook for example). These notifications would in turn push the stakeholder into taking the right actions needed to ensure the content gets published in the correct form.

However, 
what is the best possible approach if your target audience has no knowlegde whatsoever of Sitecore? Users that don't have an account and can not (or should not) be motivated into adopting your well designed Sitecore content approval approach ?

At that point the Sitecore Live Mode can come into play and offer a relatively elegant solution.

What is Sitecore Live Mode ?

When you put a Sitecore website into Live Mode you are basically changing the way Sitecore works with regards to publishing by removing the need for publishing entirely.
Sitecore basically works by using 3 databases: Core, Master, Web.

Wheras the Core database is the beating heart of the CMS and it's users and functionalities, the Master and Web databases hold all the content, languages, versions and so on. And where the Master database holds the full set of content, the Web database holds only the latest (published) version of content.

The Sitecore Live Mode configures the Sitecore website to work solely on the Master database instead of using the published Web database.

When should/can you use Sitecore Live Mode ?

The case described above already gives a good example of when this approach would prove it's value. But I'll try to list some of the cases below:
  • During development; if content needs to be checked, publishing is often needed to check if all Sitecore Items are properly rendered in the front-end. However, live-mode can remove this evil.
  • Having content previewed without the need for people to actually log into sitecore.
  • Making your content management server available for internal purposes such as content validation.

By creating an additional website configuration in the site settings you can provide a URL for internal previewing of content. So, where your public website is made available through http://www.somecompany.com you can have http://preview.somecompany.com be your internally available preview url.

Okay, how do I get this show on the road !?

Setup is actually pretty straight forward. Changes are made to the SiteDefinition.config file by adding a new <site> node. This new node has only a small, but important, number of changes :
  • Load content from the master database: database="master"
  • Set a hostName to bind to: hostName="preview.mysite.com" (DNS and IIS setup needed as well obviously)
  • Don’t filter items which preserves some basic item restrictions: filterItems="false"
  • Enable workflow: enableWorkflow="true"

<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" />

You can find this information on the Sitecore site as well: http://sdn.sitecore.net/faq/administration/live%20mode.aspx

Cool, any pitfalls though ?

Keep in mind that you are not working with Sitecore as it is meant to be used.
Sitecore tries to cache a lot of the renderings and content managed within Sitecore.
Sitecore caches are cleared when a publish event takes place. Since the live mode removes the need for publishing, these caches are no longer cleared. this is no problem on development servers since deploys reboot.

Also, keep in mind that specific search indexes with lucene will also include itemms that have publishing restrictions set. 

No comments:

Post a Comment