Valid for Sitecore All Releases
Standard Template Inheritance

Author: John West
Posted: 18-02-2008 12:00:00

Almost all Sitecore templates inherit from the Standard template included with the software. Updating template inheritance for this template or any of its base templates can result in circular template references, where a template inherits directly or indirectly from itself. Symptoms of this condition include:

  • The system becomes unresponsive, especially working with templates.
  • ASP.NET faults or raises application errors.
  • Log entries such as Circular template inheritance detected in 'Standard template'.

This scrapbook entry describes the following topics:

  • Template inheritance requirements for Sitecore’s standard template and the templates defining the sections of the standard template.
  • Symptoms resulting from changing inheritance definitions for the standard template or the templates defining the sections of the standard template.
  • How to correct inheritance issues with the standard template.

Avoid modifications to the templates provided with the system. Modifications to templates under the /sitecore/templates/system branch could complicate the process of upgrading Sitecore or raise other challenges. This consideration is especially important regarding Sitecore’s standard template and its base templates. For more information about Sitecore’s standard template, see http://sdn5.sitecore.net/Developer/Understanding Standard Template.aspx (SDN > Developer > Understanding the Standard Template).

If any template does not explicitly inherit from another template, that template implicitly inherits from Sitecore’s standard template defined under /sitecore/templates/System/Templates/Standard template, as specified by the DefaultBaseTemplate/configuration/sitecore/setting of web.config. To avoid infinite recursion, no template should ever inherit directly or indirectly from itself. The Standard template inherits from a number of templates defined under /sitecore/templates/System/Templates/Sections, each defining a section of the Standard template. The templates that define sections of the standard template must not inherit directly or indirectly from the standard template.

To avoid infinite recursion, the templates defining the sections of the standard template must not reference any base templates. To prevent the system from applying the Standard template as their default base template, the base template property of each of these templates specifies the null GUID ({00000000-0000-0000-0000-000000000000}). The null GUID indicates that a template should not inherit from any other template, and the template should not inherit from Sitecore’s standard template.

Specifying a base template changes the null GUID to the GUID of that template. Removing that specification resets the base template to an empty string rather than the null GUID. In such cases, it is necessary to restore the null GUID manually.

Sitecore by default denies access to the administrative page used to correct this issue.

Configure directory security to allow access to administrative pages

  1. Open the IIS Management Console.
  2. Expand the /sitecore/admin folder under the appropriate Web site.
  3. Right-click on the admin folder, then click Properties.
  4. On the Directory Security tab, under Anonymous access and authentication control, click Edit.
  5. Select the Anonymous access checkbox.

Consider implementing IP address and domain name restrictions to control access to these administrative pages.

Correct template inheritance issue

  1. Create a backup of the entire solution.
  2. Access /sitecore/admin/dbbrowser.aspx.
  3. For each of the templates under /sitecore/templates/System/Templates/Sections, ensure the __Base template property contains only the null GUID ({00000000-0000-0000-0000-000000000000}).

Reconfigure directory security to block access to administrative pages

  1. Open the IIS Management Console.
  2. Expand the /sitecore/admin folder under the appropriate Web site.
  3. Right-click on the admin folder, then click Properties.
  4. On the Directory Security tab, under Anonymous access and authentication control, click Edit.
  5. Clear the Anonymous access checkbox.

To avoid recurrence, on the items defining the standard template and its sections, use the Protect Item command in the Attributes group of the Configure tab.