Saturday Sitecore Learning - Templates Part 6 (Standard Values)

Standard Values

This is the sixth post as part of Sitecore Template series.

In previous posts, we learned about template fields, different field types and importance of template inheritance, in this post, let’s explore Standard Values.

Standard Values are a way to provide default values to template fields. Once we create a Standard Values for a template, and set the default values for fields, any item which is created from this template gets the default values, later content author can also modify the values, on item level.

Standard Values are also useful to have a complete picture of what are all the fields a template has, including the inherited fields.

We can also set default presentation details, and insert options on Standard values.

By looking at Standard Values, we can understand what all the fields a template contains, including the inherited fields.

Let’s take the example of three templates, which are created based on previous post

Add Standard Value

Let’s explore how to add a Standard Value to Article Template,

Step 1. Open the Content Editor, navigate to Templates & select the Article Template.

Step 2. Select the Builder Options menu from ribbon, and click on the Standard Values. (To view the Builder Options menu, on template level, we need to select the Builder tab)

Step 3. Now we should be able to see __Standard Values item under the Article template.

Step 4. If we look at newly created __Standard Values template, we can observe that there are Article template fields, as well as the inherited fields from Base Content template.

Adding Default Values:

We can add default value to a field, statically or dynamically (with tokens), for the simplicity now let’s add a static value.

Step 1: Open the Article template Standard Values, and select a today’s date for Date field, and save it.

Step 2: Create a new Article item under Home node.

Step 3: In newly created Test Article, we can see the Date field value has today’s date, and all other fields are empty. Observe that there is a Standard Value text just beside the Date field name.

Step 4: Let’s change the Date field value. Now observe that Standard Value text is disappeared, that means we have broken the Default value inheritance.

In next post, let’s explore different template types.

Happy Learning :)

Share