Example: Configure a template hierarchy

Abstract

How to best organize the template hierarchy.

In this example:

  • All content items contain a field named Title.

  • Some types of content items contain Title and a field named Body.

  • NewsArticle content items contain Title, Body, and another field named ReleaseDate.

  • Product content items contain Title, Body, and another field named Department.

  • Both NewsArticle and Product content items contain another field named Image.

  • JobDescription content items contain Title, Body, and Department, but do not contain Image.

The following table illustrates one of several possible data template inheritance hierarchies that fulfill the requirements listed above.

Note

Unless otherwise specified, all data templates inherit from the standard data template.

Create a data template...

that inherits from...

and contains the field...

Page

--

Title

ContentPage

Page

Body

HasDepartment

--

Department

HasImage

--

Image

ImageContentPage

Content Page

HasImage

--

NewsArticle

ImageContentPage

ReleaseDate

Product

ImageContentPage

HasDepartment

--

JobDescription

ContentPage

HasDepartment

--

Note

Do not use template inheritance for fields that have different properties in different data templates. For example, if you want the Image field in the NewsArticle and Product data templates to retrieve images from different locations in the media library, define image fields in each data template instead of inheriting from a common data template containing the Image field.

To add a data template section to a data template:

  1. In the Template Manager or the Content Editor, in the tree view, select the data template.

  2. On the Builder tab, in the first field containing the text Add a new section, enter the name of the new data template section.

  3. On the Builder OPTIONS tab, in the Write group, click Save.

Tip

You can create base templates before creating the data templates that inherit from them, even if you do not fully define the sections and fields of the base templates before creating the inheriting templates.