Creating Page Templates
When creating a page you must select a template, which will be used as the basis for creating the new page. The template defines the structure of the resultant page, any initial content, and the components that can be used.
With the Template Editor , creating and maintaining templates is no longer a developer-only task. A type of power-user, who is called a template author , can be involved too. Developers are still required to setup the environment, create client libraries, and create the components to be used, but once these basics are in place the template author has the flexibility to create and configure templates without a development project.
The Templates Console allows template authors to:
- Create a new template or copy an existing template.
- Manage the life cycle of the template.
The Template Editor allows template authors to:
- Add components to the template and position them on a responsive grid.
- Pre-configure the components.
- Define which components can be edited on pages created with the template.
This document explains how a template author can use the template console and editor to create and manage editable templates.
For detailed information about how editable templates work at a technical level, please see the developer document Page Templates for more information.
The Template Editor does not support targeting directly on the template level. Pages created based on an editable template can be targeted, but the templates themselves can not be.
Before You Start
An administrator must configure a template folder in the Configurations Browser and apply proper permissions before a template author can create a template in that folder.
Before you start, it is important to consider that creating a new template requires collaboration. For this reason the Role is indicated for each task. This does not impact how you actually use a template to create a page, but it does impact how a page relates to its template.
Creating a new template using the Templates Console and the Template Editor requires collaboration between the following roles:
- Admin :
- Creates a new folder for templates requires admin rights.
- Such tasks can often also be done by a developer
- Developer :
- Concentrates on the technical/internal details
- Needs experience with the development environment.
- Provides the template author with necessary information.
- Template Author :
- This is a specific author who is member of the group template-authors
- This allocates the required privileges and permissions.
- Can configure the use of components and other high level details which requires:
- Some technical knowledge
- For example, using patterns when defining paths.
- Technical information from the developer.
Due to the nature of some tasks such as creating a folder, a development environment is needed, and this requires knowledge/experience.
The tasks detailed in this document are listed with the role responsible for carrying them out.
Creating and Managing Templates
When creating a new editable template you:
- Use the Template console. This is available in the General section of the Tools console.
- Or directly at: https://<host>:<port>/libs/wcm/core/content/sites/templates.html/conf
- Can create a folder for the templates if necessary
- Create a new template , which will initially be empty
- Define additional properties for the template if required
- Edit the template to define the:
- Enable the template for use when creating a page
- Allow the template for the required page or branch of your website
- Publish the template to make it available on the publish environment
The Allowed Templates are often pre-defined when your website is initially set up.
Never enter any information that needs to be internationalized into a template.
For template elements such as headers and footers that must be localized, leverage the localization features of the core components.
Creating a Template Folder - Admin
A template folder should be created for your project to hold your project-specific templates. This is an admin task and is described in the document Page Templates .-->
When creating templates you should consider:
- The impact of changes to the template once pages have been created from that template.Here is a list of the different operations possible on templates together with how they affect the pages created from them:
Take special caution when:
- Changes to the structure:
- These are immediately applied to the resulting pages.
- Publication of the changed template is still needed for visitors to see the changes.
- Changes to content policies and design configurations:
- These apply immediately to the resultant pages.
- Publication of the changes is needed for visitors to see the changes.
- Changes to the initial content:
- These only apply to pages created after the changes to the template.
- Changes to the layout depend on whether the modified component is part of:
- Structure-only - applied immediately
- Contain initial content - only on pages created after the change
AEM gives explicit warnings when changing the lock status of components on templates that are no longer drafts.
- Locking or unlocking components on enabled templates.
- This can have side-effects, as existing pages can already be using it. Typically:
- Unlocking components (that were locked) will be missing on existing pages.
- Locking components (that were editable) will hide that content from being displayed on the pages.
- Creating your own folders for your site-specific templates.
- Publish your templates from the Templates console.