Creating Dynamic Templates in AEM
Tags: aem, aemtemplates
Published: 2022-04-14 21:46:54

---
title: Creating Dynamic Templates in AEM
published: true
description: These are my notes on how to create dynamic templates in AEM
tags: AEM, AEMTemplates
//cover_image: ![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sckd4c16kedtskqo2i41.png)
 
---

###✅ 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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zgcwgzi70rzsxmeyn00m.png)
 
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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r2316khp3oxuqtqohp00.png)

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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/s9f6gzoj2pmu0c74djr0.png)

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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/k5q6948o7ydog0pjxxhi.png)

**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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dbq08tauquwggxx2zdmr.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sumw7p8bdym8v9y6pzn3.png)

** 📣 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](https://dev.to/vish448/create-static-template-with-aem-23fi)👈