LiveMode.config and Multi-Site Sitecore Development

If you don’t want to bother publishing your local Sitecore site every time you make a change (especially when developing)…

There’s a nifty file named LiveMode.config.example, located in C:\inetpub\wwwroot\yoursitecoresite\Website\App_Config\Include\ . It comes with the sitecore install, and for a normal single-site Sitecore instance, simply removing the “.example” from the filename will let you view your site using the master database instead of the live web database. This has many advantages as a developer, namely, time-savings. Every keystroke and mouseclick counts!

What about in a multi-site instance?

When you are running two or more sites concurrently in one Sitecore instance, the recommended approach is to define each site’s host header and other information in a SiteDefinition.config file (a much better approach then directly editing the Web.config file). This file also specifies the database a site should read from. Note the database=“master” below:

<site name="yoursitecoresite" patch:before="site[@name='website']"
            virtualFolder="/"
            physicalFolder="/Sites/yoursitecoresite"
            rootPath="/sitecore/content/yoursitecoresite"
            startItem="/home"
            database="master"
            domain="extranet"
            allowDebug="true"
            cacheHtml="true"
            htmlCacheSize="10MB"
            enablePreview="true"
            enableWebEdit="true"
            enableDebugger="true"
            disableClientData="false"
            hostName="local.yoursitecoresite.org"
            enableFallback="false" />

It turns out that when working in a multi-site setup in one instance of Sitecore, the SiteDefinition.config file takes precedent, and the LiveMode.config file is completely ignored. So in our project(s), we don’t even bother to deploy LiveMode.config to a development environment. It’s redundant.

Cool! So does this mean I can just use Live Mode in production, and skip having to hit publish?

I DO NOT recommend running your live site off of the master database! You should isolate your live content from the “in-progress” editing content to avoid major workflow headaches, if it’s more than just you making changes. Plus, using master/web is the recommended approach from Sitecore, anyhow.

Advertisements