Sitecore Idiosyncrasies: Template

This blog post explains usage of the "template" (synonymous with "data template") in the Sitecore ASP.NET web Content Management System (CMS), which differs from the use of the term in other frameworks, including alternate CMS products.

Sitecore uses the term "data template", or just template, to refer to a structure that defines a data type. This differs from some other products that use the term template to define presentation formats. In many web CMS platforms, the term template relates to something like a common, predefined presentation superstructure that the system populates with values from the content repository. In Sitecore, a template has nothing to do with presentation, though the standard values of a data template can contain layout details that specify presentation components for the rendering engine to apply. For information about layout details, see the Sitecore Presentation Component Reference linked at the bottom of this page.

Every data item, or simply item, is based on a data template, which defines the sections and fields that make up that type of item. Some data templates define content types, such as the fields that make up a news articles, but Sitecore uses data templates and items for everything it can, which includes folders, taxonomy trees, configuration elements, and even template definitions. Sitecore uses a data template for data template definition items; items based on that data template store information about data templates. For more information about data templates and other concepts described in this blog post, see the Sitecore Data Definition Reference linked at the bottom of this page.

Sitecore actually uses the term template in at least three other ways:

  • Branch templates: A branch template is a predefined collection of items that a CMS user can replicate to create a new structure by selecting an insert option.
  • Command templates: CMS users can select insert options that invoke command templates, which invokes commands to create one or more items programmatically.
  • Standard template: By default, all data templates inherit from the standard (data) template, which defines a number of fields to contain numerous system properties such as item creation date and lock status.

To control the types of items that users can create beneath existing items, you can assign data templates, branch templates, and command templates as insert options, but the standard template is only relevant as a base template for other templates. You can create any number of data templates, branch templates, and command templates, but there is only one standard template. The standard template has nothing to do with standard values, which can provide default field values for items based on each data template.

You may sometimes see the term branch used to reference an item and its descendants, which is a different concept from a branch template (though a branch template is also a branch of items).

If you have any additional information about these issues or usage of the term "template" in Sitecore, please comment on this blog post.