This is the seventh post as part of Sitecore Template series.
In previous posts, we learned about template fields, field types, importance of template inheritance, and Standard Values. In this post, let’s explore Template Types.
Templates can be categorized into following ways.
- Page/Module Templates
- Folder Templates
- Branch Templates
- Parameter Templates
- Command Templates
1. Page/Module Templates
These are the templates we use for page items, as well as for modules.
- When we use the template for pages, they also contain layout information.
- When we use them for module templates, they mainly used as data sources, and they do not contain any layout information.
2. Folder Templates
Folder templates are used in a way to organize the content items. They neither contain fields (except Sitecore default fields) nor presentation details.
The default folder template is present at /sitecore/templates/Common/Folder.
Sitecore uses folder templates, in lot of places, like
- Templates Folder – To organize templates.
- Layout Folder – To organize layouts.
- Rendering Folder – To organize renderings.
- Media Folder – To organize media items.
We can also create a custom folder template to organize our items, by inhering from the default folder template – /sitecore/templates/Common/Folder.
3. Branch Templates
These are another variation of templates. At once we usually create an item from a template, but what if at a time, we need to create a group of items, Brnach template is the one to help.
They reside under /sitecore/templates/Branches
4. Parameter Templates
All the content fields are present on Page/Module templates. In some cases, we would need fields for configurations, like Search result count, background color etc, it is very tempting to create these fields also on the page/module templates. But as a best practice, we should always separate the content which will be displayed, and details of how to display the content.
We can use parameter templates to manage the details about how to display the content.
We can create a parameter template by deriving from /sitecore/templates/System/Layout/Rendering Parameters/Standard Rendering Parameters
5. Command Templates
All other template categories contains a predefined structure. But what if we need to write some dynamic logic to create items, for this we use Command templates. Command template define a class and method to be called during an insert operation. Whenever we try to create an item from this template, associate class method would be executed.
We can create a command template, using /System/Branches/Command Template
Happy Learning 🙂