Template maps
Template maps are used to determine which presentation templates are used to display each site area or content item. The presentation template used by an item is determined by the relationship between the item's authoring template and a presentation template defined in the authoring template, or a template map defined in a site area in the path of the current item. Template maps assigned in site areas will override those set in authoring templates. This can result in the following relationships:
- A content item can be displayed using two different presentation templates if linked to different site areas.
- Two items using different authoring templates can be displayed using the same presentation template if both authoring templates are mapped to the same presentation template.
- Defined in authoring templates
- If we select a default presentation template in an authoring template, it will be used as the default presentation template for all items based on that authoring template. This will ensure that all items based on that authoring template will be rendered with the same presentation template, but it does not guarantee design consistency between other items located in the same site area. If a different template map is specified in any site area in the item path, then the template map defined in the lowest part of the item path will be used instead.
- Defined in site areas
- If we define a template map in a site area, this will ensure that all items based on the selected authoring template will use the same presentation template in that site area. If a different template map is specified in any child site areas of the parent site area, then the template map defined in site area in the lowest part of the item path will be used.
In these examples AT is authoring template, PT is presentation template and SA is site area.
- AT 1 uses PT 1 as its default presentation template
- AT 2 uses PT 2 as its default presentation template
- AT 3 uses PT 2 as its default presentation template
- AT 4 has no default presentation template
- SA 1 has no template map
- SA 2 contains a map between AT 1 and PT 2
- SA 1 and SA 2 are located under SA A.
- SA A contains a map between AT 4 and PT 3
The presentation template used by each item will be determined by the authoring template the item used, and the location of the item in the site framework.
Content and location Result Content 1 using AT 1 located in SA 1 As SA 1 contains no template maps, Content 1 is displayed using PT 1 which is the default presentation template of AT 1. Content 1 using AT 1 located in SA 2 As SA 2 contains a map between AT 1 and PT 2, Content 1 is instead displayed using PT 2. Content 2 using AT 2 located in SA 1 As SA 1 contains no template maps, Content 2 is displayed using PT 2 which is the default presentation template of AT 2. Content 3 using AT 3 located in SA 1 As SA 1 contains no template maps, Content 3 is also displayed using PT 2 which is the default presentation template of AT 3. Content 4 using AT 4 located in SA 1 As SA 1 contains no template maps, Content 4 is displayed using PT 3 which is mapped to AT 4 in SA A.
Element references
When referencing elements in a presentation it is important to note the following:
- The elements a presentation template uses must be defined in the authoring template the content is based on.
- If the element being referenced does not exist in the current item, nothing is displayed in that section of the presentation template.
Although the template author can identify a number of elements that can be displayed on the item form, whether the elements are displayed depends on the presentation template used with the authoring template to render the content form. A presentation template might not include every element defined in an authoring template, but in order for an element or element type to be available to a presentation template, the element must be included in the authoring template used to create the content.
Parent: Web content items