1

Tip: Sitecore site inheritance in the configuration

A neat little trick in Sitecore for when you’re doing a multi-site instance of Sitecore is to use the property inheritance in the configuration.

Instead of doing something like the following;

<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
	<sitecore>
		<sites>
			<site name="website" rootPath="/sitecore/content/website" virtualFolder="/" physicalFolder="/" startItem="/home" database="web" domain="extranet" allowDebug="true" cacheHtml="true" htmlCacheSize="50MB" registryCacheSize="0" viewStateCacheSize="0" xslCacheSize="25MB" filteredItemsCacheSize="10MB" enablePreview="true" enableWebEdit="true" enableDebugger="true" disableClientData="false" />
			<site name="myAwesomeWebsite" rootPath="/sitecore/content/awesome website" virtualFolder="/" physicalFolder="/" startItem="/home" database="web" domain="extranet" allowDebug="true" cacheHtml="true" htmlCacheSize="50MB" registryCacheSize="0" viewStateCacheSize="0" xslCacheSize="25MB" filteredItemsCacheSize="10MB" enablePreview="true" enableWebEdit="true" enableDebugger="true" disableClientData="false" />
			<site name="myEvenMoreAwesomeWebsite" rootPath="/sitecore/content/even more awesome website" virtualFolder="/" physicalFolder="/" startItem="/home" database="web" domain="extranet" allowDebug="true" cacheHtml="true" htmlCacheSize="50MB" registryCacheSize="0" viewStateCacheSize="0" xslCacheSize="25MB" filteredItemsCacheSize="10MB" enablePreview="true" enableWebEdit="true" enableDebugger="true" disableClientData="false" />
		</sites>
	</sitecore>
</configuration>

Use the inheritance property to select a base site and use all of its properties;

<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
	<sitecore>
		<sites>
			<site name="website" virtualFolder="/" physicalFolder="/" rootPath="/sitecore/content/website" startItem="/home" database="web" domain="extranet" allowDebug="true" cacheHtml="true" htmlCacheSize="50MB" registryCacheSize="0" viewStateCacheSize="0" xslCacheSize="25MB" filteredItemsCacheSize="10MB" enablePreview="true" enableWebEdit="true" enableDebugger="true" disableClientData="false" />
			<site name="myAwesomeWebsite" rootPath="/sitecore/content/awesome website" inherits="website" />
			<site name="myEvenMoreAwesomeWebsite" rootPath="/sitecore/content/even more awesome website" inherits="website" />
		</sites>
	</sitecore>
</configuration>

Also check out this resource on how to extend Sitecore so you can do multi-level site property inheritance.

Jason Bert