Templates to Create Pages that are Editable with the Page Editor creating-page-templates
You can use the Template Editor to create templates that your content authors can use to create pages that are editable with the Page Editor.
Overview overview
When an author creates a page, they must select a template, which is used as the basis for the new page. The template defines the structure of the resultant page, any initial content, and the components that can be used when editing the page in the Page Editor.
With the Template Editor, creating and maintaining templates is not developer-only task. A type of power-user, who is called a template author, can create templates. Developers are 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 involving a developer.
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 Editor to create and manage editable templates.
For detailed information about how editable templates work at a technical level, see the developer document Editable Templates for more information.
Before You Start before-you-start
Before you start, it is important to consider that creating a 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.
Roles roles
Creating a new template 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
- Creates a new folder for templates requires
-
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.
- Some technical knowledge
-
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 creating-and-managing-templates
When creating an editable template you:
-
Create a new template, which will initially be empty
-
Define additional properties for the template if necessary
-
Edit the template to define the:
- Structure - Predefined content that cannot be changed on pages created with the template.
- Initial Content - Predefined content that can be changed on pages created with the template.
- Layout - For a range of devices.
- Styles - Define the styles to be used with the template and its components.
-
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
Creating a Template Folder - Admin 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.
Creating a New Template - Template Author creating-a-new-template-template-author
-
Open the Templates Console then navigate to the required folder.
note note NOTE In a standard AEM instance the global folder already exists in the template console. This holds default templates and acts as a fallback if no policies and/or template-types are found in the current folder. It is recommended best practice to use a template folder created for your project. -
Select Create, followed by Create Template to open the wizard.
-
Pick a Template Type, then select Next.
note note NOTE Template types are predefined template layouts and can be thought of as templates for a template. These are predefined by developers or the system administrator. More information can be found in the developer document Page Templates.–> -
Complete the Template Details:
- Template Name
- Description
-
Select Create. A confirmation is shown, select Open to start editing the template or Done to return to the template console.
note note NOTE When a new template is created it is marked as Draft in the console, this indicates that it is not yet available to use by page authors.
Defining Template Properties - Template Author defining-template-properties-template-author
A template can have the following properties:
-
Image
-
Image to be used as a thumbnail of the template to aid selection such as in the Create Page wizard.
- Can be uploaded
- Can be generated based on the template content
-
-
Title
- A title used for identifying the template such as in the Create Page wizard.
-
Description
- An optional description to provide more information about the template and its use, which can be seen for example, in the Create Page wizard.
After creating the template, use the Templates Console to view or edit the template properties.
Template Thumbnail Image template-thumbnail-image
To define the template thumbnail:
-
Edit the template properties.
-
Choose if you want to upload a thumbnail or have it generated from the template content.
- If you want to upload a thumbnail, select Upload Image
- If you want to generate a thumbnail, select Generate Preview
-
For both methods a preview of the thumbnail is displayed.
- If it is not satisfactory, select Clear to upload another image or re-generate the thumbnail.
-
When you are satisfied with the thumbnail, select Save & Close.
Enabling and Allowing a Template - Template Author enabling-and-allowing-a-template-template-author
To be able to use a template when creating a page you need to:
- Enable the template to make it available for use when creating pages.
- Allow the template to specify the content branches where the template can be used.
Enabling a Template - Template Author enabling-a-template-template-author
A template can be enabled or disabled to make it available or unavailable in the Create Page wizard.
Use the Templates Console to enable or disable a template.
Allowing a Template - Author allowing-a-template-author
A template can be made available or unavailable for certain page branches.
-
Open the Page Properties for the root page of the branch where you want the template to be available.
-
Open the Advanced tab.
-
Under Template Settings use Add field to specify the path(s) to your template(s).
The path can be explicit or use patterns. For example:
/conf/<your-folder>/settings/wcm/templates/.*
The order of the paths is irrelevant. All paths are scanned and any templates retrieved.
note note NOTE If the Allowed Templates list is left empty, then the tree is ascended until a value/list is found. See Template Availability - the principles for allowed templates remain the same. -
Click Save to save the changes to the page properties.
Publishing a Template - Template Author publishing-a-template-template-author
As the template is referenced when a page is rendered, the fully configured template must be published so that it is available on the publish environment.
Publish templates using the Templates Console.
Editing Templates - Template Authors editing-templates-template-authors
When creating or editing a template there are various aspects that you can define. Editing templates is similar to page authoring.
The Mode selector in the toolbar lets you select and edit the appropriate aspect of the template:
While the Page Policy option on the Page Information menu lets you select the required page policies:
Template Attributes template-attributes
The following attributes of a template can be edited:
Structure template-structure
Components added to the structure cannot be moved/removed from resultant pages by the page authors. If you want page authors to be able to add and remove components to resultant pages, then you need to add a paragraph system to the template.
When components are locked you can add content, which cannot be edited by page authors. You can unlock components to allow you to define Initial Content.
Initial Content template-initial-content
When a component has been unlocked you can define the initial content that is copied to the resultant page(s), created from the template. These unlocked components can be edited on the resulting page(s).
Layout template-layout
With the layout you can predefine the template layout for the required device formats. Layout mode for template authoring has the same functionality as the Layout mode for page authoring.
Page Policies template-page-policies
Page policies can connect predefined page policies to the page. These page policies define the various design configurations.
Styles template-styles
The Style System allows a template author to define style classes in the content policy of a component so that a content author is able to select them when editing the component on a page. These styles can be alternative visual variations of a component, making it more flexible.
Please see the Style System documentation for more information.
Editing a Template - Structure - Template Author editing-a-template-structure-template-author
In Structure mode you define components and content for your template and define policy for the template and its components.
- Components defined in the template structure cannot be moved on a resulting page nor deleted from any resulting pages.
- If you want page authors to be able to add and remove components, add a paragraph system to the template.
- Components can be unlocked and locked again to allow you to define initial content.
- The design policies for the components and page are defined.
There are several actions you can take in the Structure mode of the template editor and several features to assist you:
Add Components add-components
There are several mechanisms for adding components to the template:
- From the Components browser in the side panel.
- By using the Insert Component option available on the toolbar of components already on the template or the Drag components here box.
- By dragging an asset (from the Assets browser in the side panel) directly onto the template to generate the appropriate component in situ.
Once added, each component is marked with:
- A border
- A marker to show the component type
- A marker to show when the component has been unlocked
Component Actions component-actions
Take actions on the components once they have been added to the template. Each individual instance has a toolbar that lets you access the available actions, the toolbar is dependent on the component type.
It can also be dependent on actions taken such as when a policy has been associated with the component, then the design configuration icon becomes available.
Edit and Configure edit-and-configure
With these two actions you can add content to your components.
Border to Indicate Structure border-to-indicate-structure
When working in Structure mode an orange border indicates the component currently selected. A dotted line also indicates the parent component.
Policy and Properties (General) policy-and-properties-general
The content (or design) policies define the design properties of a component. For example, the components available or minimum/maximum dimensions. These are applicable to the template (and pages created with the template).
Create a content policy, or select an existing one, for a component.
This lets you define the design details.
The configuration window is divided in two.
- In the left side of the dialog under Policy, you can select an existing policy or select an existing one.
- In the right side of the dialog under Properties, you can set the properties specific to the component type.
The properties available are dependent on the selected component. For example, for a text component the properties define the copy and paste options, formatting options, and paragraph style amongst other options.
Policy policy
The content (or design) policies define the design properties of a component. For example, the components available or minimum/maximum dimensions. These are applicable to the template (and pages created with the template).
Under Policy you can select an existing policy to apply to the component by way of the drop-down.
A new policy can be added by selecting the add button next to the Select policy drop-down. Give a new title in the Policy Title field.
The selected existing policy in the Select policy drop-down list can be copied as a new policy using the copy button next to the drop-down list. Give a new title in the Policy Title field. By default the copied policy is titled Copy of X, where X is the title of the copied policy.
A description of the policy is optional in the Policy Description field.
In the Other templates also using the selected policy section, you can easily see which other templates use the policy selected in the Select policy drop-down list.
Properties properties
Under the Properties heading you can define the settings of the component. The heading has two tabs:
- Main
- Features
Main main
On the Main tab, the most important settings of the component are defined.
For example, for an image component the allowed widths can be defined along with enabling lazy loading.
If a setting allows for multiple configurations, select the Add button to add another configuration.
To remove a configuration, select the Delete button located to the right of the configuration.
To remove a configuration, select the Delete button.
Features features
The Features tab lets you enable or disable additional features of the component.
For example, for an image component you can define the cropping proportions, allowed image orientations, and if uploads are allowed.
Policy and Properties (Layout Container) policy-and-properties-layout-container
The policy and properties settings of a layout container are similar to the general usage, but with some differences.
The configuration window is divided in two, just as in the general usage of the window.
Policy policy-layout
The content (or design) policies define the design properties of a component. For example, the components available or minimum/maximum dimensions. These are applicable to the template (and pages created with the template).
Under Policy you can select an existing policy to apply to the component via the drop-down. This functions just as it does in the general usage of the window.
Properties properties-layout
Under the Properties heading you can choose which components are available for the layout container and define their settings. The heading has three tabs:
- Allowed Components
- Default Components
- Responsive Settings
Allowed Components allowed-components
On the Allowed Components tab, you define which components are available for the layout container.
- The components are grouped by their component groups, which can be expanded and collapsed.
- An entire group can be selected, by checking the group name and all can be deselected by unchecking.
- A minus represents at least one but not all items in a group are selected.
- A search is available to filter for a component by name.
- The counts listed to the right of the component group name represent the total number of selected components in those groups regardless of the filter.
Default Components default-components
On the Default Components tab, you define which components are automatically associated with given media types so that when an author drags an asset from the asset browser, AEM knows with which component to associate it. Only components with drop zones are available for such configuration.
Select Add Mapping to add an entirely new component and MIME type mapping.
Select a component in the list and select Add type to add an additional MIME type to an already mapped component. Click the Delete icon to remove a MIME type.
Responsive Settings responsive-settings
On the Responsive Settings tab you can configure the number of columns in the resulting grid of the layout container.
Unlock and Lock Components unlock-and-lock-components
You unlock/lock components to define whether the content is available for change in Initial Content mode.
When a component has been unlocked:
- An open padlock indicator is shown in the border.
- The component toolbar is adjusted accordingly.
- Any content already entered will no longer be shown in Structure mode.
- Already entered content is considered initial content and is only visible in Initial Content mode.
- The parents of the unlocked component cannot be moved, cut or deleted.
This includes unlocking container components so that further components can be added, either in Initial Content mode or on resulting pages. If you have already added components/content to the container before unlocking it, then these are no longer be shown when in Structure mode, but they are shown in Initial Content mode. In Structure Mode, only the container component itself is shown with its list of Allowed Components.
To save space, the layout container does not grow to accommodate the list of allowed components. Rather the container becomes a scrollable list.
Components that are configurable are shown with a Policy icon, which can be tapped or clicked to edit the policy and properties of that component.
Relationship to Existing Pages relationship-to-existing-pages
If the structure is updated after creating pages based on the template, then these pages will reflect the changes to the template. A warning is displayed in the toolbar to remind you of this fact along with confirmation dialogues.
Editing a Template - Initial Content - Author editing-a-template-initial-content-author
Initial Content mode is used to defined content that will appear when a page is first created based on the template. The initial content can then be edited by page authors.
Although all content created in Structure mode is visible in Initial Content, only components that have been unlocked can be selected and edited.
-
Unlocked components that are available for editing are marked. When selected they have a blue border:
-
Unlocked components have a toolbar allowing you to edit and configure the content:
-
If a container component has been unlocked (in Structure mode) then you can add new components to the container (in Initial Content mode). Components added in Initial Content mode can be moved on or deleted from resulting pages.
You can add component using either the Drag components here area or the Insert New Component option from the toolbar of the appropriate container.
-
If the initial content of the template is updated after pages are created based on the template, then these pages will not be affected by changes to the initial content in the template.
Editing a Template - Layout - Template Author editing-a-template-layout-template-author
You can define the template layout for a range of devices. Responsive layout for templates operates as it does for page authoring.
Editing a Template - Page Policy - Template Author/Developer editing-a-template-page-policy-template-author-developer
The page policy including required client-side libraries is maintained under the Page Policy option of the Page Information menu.
To access the Page Policy dialog:
-
From the Template Editor, select Page Information from the toolbar, then Page Policy to open the dialog.
-
The Page Policy dialog opens and is divided into two sections:
- The left half defines the page policies
- The right half defines the page properties
Page Policies page-policies
You can apply a content policy to either the template or resultant pages. This defines the content policy for the main paragraph system on the page.
-
You can select an existing policy for the page from the Select policy drop-down.
A new policy can be added by selecting the add button next to the Select policy drop-down list. Give a new title in the Policy Title field.
The selected existing policy in the Select policy drop-down list can be copied as a new policy using the copy button next to the drop-down list. Give a new title in the Policy Title field. By default the copied policy is titled Copy of X, where X is the title of the copied policy.
-
Define a title for the policy in the Policy Title field. A policy is required to have a title so that it can be easily selected in the Select policy drop-down list.
-
A description of the policy is optional in the Policy Description field.
-
In the Other templates also using the selected policy section, you can easily see which other templates use the policy selected in the Select policy drop-down list.
Page Properties page-properties
Using page properties, you can define the required client-side libraries by using the Page Design dialog. These client-side libraries include stylesheets and javascript to be loaded with the template and pages created with that template.
-
Specify the client-side libraries you want applied to pages created with this template. Entering the name of a library in the text field in the Client Side Libraries section.
-
If multiple libraries are needed, click the Add button to add an additional text field for the library name.
Add as many text fields as necessary for your client-side libraries.
-
Define the libraries’ relative position as necessary by dragging the fields using the drag handle.
Editing a Template - Initial Page Properties - Author editing-a-template-initial-page-properties-author
Using the Initial Page Properties option, you can define the initial page properties to be used when creating resultant pages.
-
From the template editor, select Page Information from the toolbar, then Initial Page Properties to open the dialog.
-
In the dialog you can define the properties you want applied to pages created with this template.
-
Confirm your definitions with Done.
Best Practices best-practices
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:
-
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
Take special caution when:
-
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) are missing on existing pages.
- Locking components (that were editable) will hide that content from being displayed on the pages.
note note NOTE AEM gives explicit warnings when changing the lock status of components on templates that are no longer drafts. -
-
Creating your own folders for your site-specific templates.
-
Publish your templates from the [Templates console.](https://experienceleague.adobe.com/docs/experience-manager-cloud-service/content/sites/administering/templates-console.html?lang=en)