How to Create Templates in Sitecore CMS

December 16, 2014

Blog | Development | How to Create Templates in Sitecore CMS
How to Create Templates in Sitecore CMS

This is the thirteenth in a series of posts about learning how to use and develop for Sitecore CMS; it is the follow-up post to “How to Configure Help Text on Items in Sitecore CMS”. In this “How to” post I will be covering how to create templates in Sitecore CMS.

In /sitecore/templates select the folder where the templates should be created.

Using the context menu, folder editor, or ribbon, click the “New Template” button.

Sitecore 8 showing the new template button
Sitecore 8 showing the new template button
Sitecore 6 showing the new template button
Sitecore 6 showing the new template button

A “Create Template” wizard will appear.

Click the “Next” button to continue the wizard.

The “Select name” page will appear.

Sitecore 8 showing the select name page
Sitecore 8 showing the select name page
Sitecore 6 showing the select name page
Sitecore 6 showing the select name page

The “Name” field is used to specify the name of the template being created. If you make a spelling mistake, the name can be changed by renaming the template item directly.

The “Base template” field will default to /sitecore/Templates/System/Templates/Standard template. It’s the base template for most items in Sitecore, and contains the standard fields. Different templates can be selected to create inheritance hierarchies. Template inheritance will be covered in depth in a future blog post.

Click the “Next” button to continue with the wizard.

The “Location” page will appear.

Sitecore 8 showing the location page
Sitecore 8 showing the location page
Sitecore 6 showing the location page
Sitecore 6 showing the location page

By default the folder where the template was created will be selected in the treelist. If you’d like to create the template in a different folder, select the new folder where the template belongs.

Click the “Next” button to continue the wizard.

A summary page will appear confirming that the template was created successfully.

Sitecore 8 showing the summary page
Sitecore 8 showing the summary page
Sitecore 6 showing the summary page
Sitecore 6 showing the summary page

Click the “Finish” button to close the wizard and select the newly created template.

Managing Template Fields

The newly created template won’t have any template sections or fields. When a template item is selected, a “Builder” tab will appear in the content editor. When the “Builder” tab is selected, an additional “Builder” tab will appear in the ribbon as well.

Sitecore 8 showing the builder tabs
Sitecore 8 showing the builder tabs
Sitecore 6 showing the builder tabs
Sitecore 6 showing the builder tabs

Tim Leverett

Senior Developer
Tags
  • Sitecore
  • Tutorial
Sitecore Survival Guide Volume 1

If you found this post helpful, there are plenty more where it came from! You'll find the first 10 here.

Download the first 10 posts in our Sitecore how-to series by Developer Tim Leverett!

Creating a Template Section

Template sections are used to group similar fields together. Although “Template section” items can be created manually by creating child items from the Template, the Builder tab allows for rapid development of template sections and fields.

In the text field labelled, “Add a new section,” type a name for the new template section. A set of fields will appear after the first section field, and another field labelled “Add a new section” will be created.

Sitecore 8 showing a section being created in a template

Sitecore 8 showing a section being created in a template

Sitecore 6 showing a section being created in a template

Sitecore 6 showing a section being created in a template

Saving the template item will automatically create the template section as a child of the template.

Sitecore 8 showing the newly created template section

Sitecore 8 showing the newly created template section

Sitecore 6 showing the newly created template section

Sitecore 6 showing the newly created template section

Creating fields

In the text field labelled “Add a new field,” type a name for the new template field. As with the Template section, a set of fields will appear after the first field’s row.

Sitecore 8 showing a field being created in the template

Sitecore 8 showing a field being created in the template

Sitecore 6 showing a field being created in the template

Sitecore 6 showing a field being created in the template

Saving the template item will automatically create the template field as a child of the template section.

Sitecore 8 showing the newly created template field

Sitecore 8 showing the newly created template field

Sitecore 6 showing the newly created template field

Sitecore 6 showing the newly created template field

The field type can be specified in the drop-down in the “Type” column. “Single-Line Text” will be selected by default.

Creating Items from Custom Templates

Once the template is finalized, items based on the template can be created by selecting the template when creating new items.

The items created from the template will have the template sections and fields as defined in the template.

Sitecore 8 showing an example item created from the new template

Sitecore 8 showing an example item created from the new template

Sitecore 6 showing an example item created from the new template

Sitecore 6 showing an example item created from the new template

Up next: “How to Configure Template Sections in Sitecore CMS”

Recent Work

Check out what else we've been working on