- Whenever we create a page we need to select a Template. The template defines the structure of the page
- Whenever we create a Content Fragment we need to select a Template. This template defines the structure, Initial Content and Variation
Type of Templates:
- Editable Templates allows Authors to Create and Edit Templates and these authors are called template authors.
- This templates ensures that any changes made to the template are reflected in the pages too.
- We can configure the various combinations of components in a UI, thereby eliminating the need for a new page component to be developed for each page variation.
- You can see here how to create Editable templates
- Template Authors can Add components to templates and position them on a responsive grid, pre-configure them and define which components can be edited on pages using Template Editor
- A static template is a hierarchy of nodes that has the same structure as the page to be created, but without any actual content.
- These are defined and configured by Developers.
- These Templates have Design mode which persist design properties.
- You can see here how to create Static Templates.
Properties of templates:
cq:Template : A template is of node type cq:Template.
allowedChildren : Path of a template that is allowed to be a child of this template.
allowedParents : Path of a template that is allowed to be a parent of this template.
allowedPaths : Path of a page that is allowed to be based on this template.
Ranking : Rank of the template. Used to display the template in the User Interface.
CONTENT FRAGMENT TEMPLATES:
Templates are selected when creating a content fragment. They provide the new fragment with the basic structure, element(s) and variation. These templates are subjected under Granite Configuration Manager. You can refer this link on how to create Content Fragment Templates.
The out-of-the-box templates are held under:
The location for instance-wide customer-specific templates that need to be changed at runtime.
ADAPTIVE TEMPLATE RENDERING:
- Templates are generally built around a responsive grid, and pages created based on these templates are fully responsive, adjusting automatically to the viewport of the client device.
- Using the Emulator toolbar in the page editor, authors can target layouts to specific devices.
- It is also possible to set up templates to support adaptive rendering.
- When device groups are properly configured, the page will be rendered with a different selector in the URL when selecting a device in the emulator mode. Using a selector a specific page rendering can be directly called via the URL. For More Information see here Adaptive Templates Rendering.