Editable Templates in AEM

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?

  1. I’ll introduce editable templates and compare with static template, supporting the decision between the two.
  2. I’ll summarize the main steps for creating editable templates
  3. 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 (1)

Key terms

  • 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?

Development part

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

  1. 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.
    1. This is to be done in e.g. /conf/mybrand/settings/wcm/template-types/basepage
    2. It was created based on OOB template types found in /libs/settings/wcm/template-types
    3. I removed the support for Layout mode.

Configuration part

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

  1. As a template author, we configure the following for each template created
    1. Structure
      1. Here we add various components to the page template to make it specific. E.g. header, footer, hero image, …
      2. Lock or unlock any components in order to control, what an author can or cannot modify.
    2. Initial content
      1. In this mode we setup some initial content for the author
      2. 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.
    3. Content policies
      1. 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

  1. New templates created have to be
    1. Enabled (for use on the author), and
    2. Published
  2. The new templates also have to be enabled for specific content areas.
    1. 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 🙂

Lessons learnt

  1. 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.
  2. Editable templates do not work with the classic UI. It is no surprise, Adobe has called it out in the public documentation, too.
  3. 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.

Leave a Reply

Your email address will not be published. Required fields are marked *

Pin It on Pinterest