DEV Community

Vishang
Vishang

Posted on • Updated on

Creating Dynamic Templates in AEM

✅ Benefits

  • Allow template authors to create and edit templates
  • Provide templates that retain a dynamic connection to any of the pages created from them
  • Make the page component more generic so that the core page component can be used without customization

👋 How To

Create configuration 🥨

  • Go to AEM Tools -> Configuration Browser -> Create Configuration Give the title and tick the checkbox Editable Templates Image description

Once the configuration is created. You can go to CRXDE /conf/your-configuration/settings/wcm you can see the structure is created with
-templates
-policies
-template-types

Image description

Template node should be empty as we have not created any templates.

Go to AEM tools -> Templates -> Pick your folder you just created using configuration (in this case i have MyDynamicTemplate folder is available then) -> create a template -> choose any out of the box base template. -> Give Title & Description of the template

Image description

Now, the template is created you can edit this template in template editor as per your requirements.

I keep adding few layout container to create the structure of the page.

👋 Content policies for editable templates

Content policies are used to define the design properties of a component
These polices are applicable to the templates and pages created from the templates

Initially, all the components available on the templates are locked. So template author can not do anything on the page. Unlock components in order for authors to make changes by simply click on the unlock button in the editable template.

Image description

Lock: unlock the component so authors can edit the components.
Page Policy: You can create and define the policy so only allowed components are available to authors.

👋 Use Template to create a page

In order to use the created template to create a page you have to enable the template first.

Image description

Image description

** 📣 One last step before your template show up to create page.**

If the template does not show up in the options where you want to create a page.

Go to -> Properties(p) -> Advanced Tab
Scroll to Template Settings options and add the editable template path Save and Close.

Now the template is available. 🙌

👉Notes on Static Templates in AEM👈

Top comments (0)