Return to doc.sitecore.com

  Things to remember when renaming or adding a site
Prev Next

Sitecore clears the cache upon each publishing. The Cache Clearer is bound to specific sites. So if you add a new site where caching is important or rename the standard 'website' site, you should also add/rename appropriate sites under the publish:end event in the <events> section. See the example below.
Say, we’ve added SITE1 and SITE2 into the <sites> section.

       <site
        name="SITE1"
        virtualFolder="/"
         ....
        enableDebugger="true" />
 
      <site
        name="SITE2"
        virtualFolder="/"
         ....
        enableDebugger="true" />

Configure the publish:end event:

<events>
...
      <event name="publish:end">
        <handler type="Sitecore.Publishing.HtmlCacheClearer, Sitecore.Kernel" method="ClearCache">
          <sites hint="list"><site>website</site>
           <site>website</site>
           <site>SITE1</site>
           <site>SITE2</site>
          </sites>
        </handler>
        <handler type="Sitecore.EventHandlers.CredentialCacheClearer, Sitecore.EventHandlers" method="ClearCache">
          <sites hint="list"><site>website</site></sites>
        </handler>
      </event>

Add entries to the <cacheSizes> section

    <cacheSizes>
     ...
        <website>
          <html>10MB</html>
          <registry>0</registry>
          <viewState>0</viewState>
          <xsl>5MB</xsl>
        </website>
 
        <SITE1>
          <html>10MB</html>
          <registry>0</registry>
          <viewState>0</viewState>
          <xsl>5MB</xsl>
        </SITE1>
 
        <SITE2>
          <html>10MB</html>
          <registry>0</registry>
          <viewState>0</viewState>
          <xsl>5MB</xsl>
        </SITE2>
 
      </sites>
    </cacheSizes>

Note that you must take into account the 'Preview.DefaultSite' setting, which specifies the default site to be used in Preview mode. For example, if you rename the standard 'website' site, and add e.g. site1, please change the setting in the following way:

<setting name="Preview.DefaultSite" value="site1" />

Prev Next