With Editable Templates, in AEM 6.2 a long awaited feature has arrived and it was updated with AEM 6.3. Although AEM 6.2 is available for a year already, I just got the chance to deep dive into editable templates recently. In this post I summarize my findings with editable templates in AEM 6.2 and another post will cover the updates with AEM 6.3.
Why to read my post?
- I’ll introduce editable templates and compare with static template, supporting the decision between the two.
- I’ll summarize the main steps for creating editable templates
- You will find a list of issues I encountered with editable templates. Hope you can avoid them using my suggestions.
Why is the Template Editor (and editable templates) a long awaited feature?
Static templates are those that we used to develop prior to AEM 6.2. A static template consists of a page component with a fixed structure, that was created by developers, and one or more page templates that content authors used for instantiating new pages and filling them with initial content.
In contrast with static templates, editable templates rely on a configuration layer where the structure, the initial content and content policies are described using configuration rather than in a programmatic way.
So with editable templates, it is no longer necessary to involve developers and make another release of the code base in order to create new page templates.
With editable templates, a new tool called Template Editor was added to AEM and the existing tools were updated where necessary, to support the following process:
- Template Editor = The tool where editable templates can be created from static base templates. Used by template authors.
- Structure mode = The editing mode in the template editor in which new components can be added to an editable template. Changes made here will have an impact on already created pages.
- Content policy = Ability to configure, what a content editor will be allowed to do when creating a new page. For example:
- Make a component editable
- Setup allowed components to be added to page or specific container
- Initial content = Content that is added automatically when creating a new page from an editable template. This content can be changed or removed by the content editor once a new page was created. Changes to initial content in the template editor won’t have an impact on pages already created.
How to create editable templates?
These steps are to be done by developers. Once they are ready, template authors can create new templates without having to make new releases of the code base.
1. Have an appropriate page component in place
While using the template editor, we start from a static base page template developed the “usual aem way”. However, this page component must support structure components.
2. Create a template type definition
- We have to create a template type definition for the base page template, to enable this base page template to be used as input for the Template Editor.
- This is to be done in e.g. /conf/mybrand/settings/wcm/template-types/basepage
- It was created based on OOB template types found in /libs/settings/wcm/template-types
- I removed the support for Layout mode.
These steps can be repeated as many times as necessary. A specific role called “template author” was introduced to perform these steps.
3. Create a template
- As a template author, we configure the following for each template created
- Here we add various components to the page template to make it specific. E.g. header, footer, hero image, …
- Lock or unlock any components in order to control, what an author can or cannot modify.
- Initial content
- In this mode we setup some initial content for the author
- If we leave the component unlocked, then this initial content can be changed or even removed by the author on the page created from this template.
- Content policies
- This is similar to the design mode. Here we configure, what components can be dropped into the various containers on the page.
This settings are saved under the configuration area created for the brand: /conf/mybrand/settings/wcm/templates/…).
4. Enable and publish
- New templates created have to be
- Enabled (for use on the author), and
- The new templates also have to be enabled for specific content areas.
- This can be done by opening the Page Properties of a content page (preferable a root node or parent page like e.g. /content/mybrand) and configuring the allowed templates on the Advanced tab.
5. Create web pages
Enjoy the benefit of editable templates 🙂
- The OOB parsys component cannot be used as main content placeholder on the base template for creating editable templates. You have to use the layout container component.
- Editable templates do not work with the classic UI. It is no surprise, Adobe has called it out in the public documentation, too.
- The foundation page component is compatible with the template editor, so start your template from this. I wanted to make an email page template based on the foundation newsletter page, and it didn’t work in the Template editor. Reason is that the structure components are not included by the foundation newsletter page. It can be fixed easily based on the foundation page component.