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 lifecycle 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 - Editable for more information.
AEM 18.104.22.168 or later is required to use editable templates with the SPA Editor .
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.
Pages and templates created with the Templates Console are not meant to be used with the classic UI and such use is not supported.
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.
The following points are important to consider before you start:
- Creating a new template requires collaboration. For this reason the Role is indicated for each task.
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.
Editable and Static Templates
AEM now offers two basic types of templates:
- Editable Templates
- After the new page is created a dynamic connection is maintained between the page and the template. This means that changes to the template structure and/or locked content will be reflected on any pages created with that template. Changes to the unlocked (i.e. initial) content will not be reflected.
- Use content policies, which you can define these from the template editor, to persist the design properties. Design mode within the page editor is no longer used for editable templates.
- Static Templates
- Static templates have been available for several versions of AEM.
- They are provided by your developers , so they cannot be created or edited by authors.
- Are copied to create the new page, but no dynamic connection exists after this (though the template name is registered for information).
- Use Design Mode to persist design properties.
- Because editing static templates is the exclusive task of a developer, please see the developer document Page Templates - Static for more information.
By definition, the template console and template editor only allow creation and editing of editable templates. Therefore this document focuses exclusively on editable templates.
Using a Template to Create a Page
When using a template to create a new page there is no visible difference and no indication between static and editable templates. For the page author, the process is transparent.
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.
- 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.
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 - Editable .
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.