N
Naveenr.dev
Chapter 08
12 min read2026-06-21

Understanding AEM Templates

Learn how AEM templates define page structure and governance. Understand editable templates, template types, creation steps, and how templates enable consistent page creation at scale.

Content Objective

In this chapter, you'll understand:

  • What AEM templates are and why they're essential for consistent page creation
  • The difference between static and editable templates
  • How the editable template workflow connects templates to pages
  • The critical distinction between Structure and Initial Content tabs
  • How pages are created from templates in practice

The Journey So Far

In the previous chapters, we built a complete understanding of AEM's architecture:

  • Chapter 1: How requests flow through Dispatcher to AEM
  • Chapter 2: How ResourceResolver finds content
  • Chapter 3: How Components are resolved and scripts are located
  • Chapter 4: How request paths are decomposed (selectors, extensions, suffixes)
  • Chapter 5: How Sling Models adapt resources into Java objects
  • Chapter 6: How HTL generates the final HTML
  • Chapter 7: How components work together to form complete pages

You now understand how individual components render.

But how are pages created in the first place?

How does AEM ensure that pages follow consistent structure and design?

How do authors create new pages without requiring developer involvement?

The answer lies in Templates.

Templates define the blueprint from which pages are created, ensuring consistency, governance, and scalability across large websites.

What is an AEM Template?

The template is a starting point for creating pages in AEM. Think of it like this, every time you make a new page, it follows the structure defined by the template.

If you've worked with any CMS before, you know how frustrating it can be when every page is built differently. AEM templates solve that by keeping things consistent. Instead of manually adding headers, footers, and layouts every time, you just pick a template and create your page, and good to go.

AEM offers two solutions to meet developer and content author needs, balancing flexibility, control, and ease of use.

Why Do We Need Templates in AEM?

  • Consistency Across Pages — Every page follows the same structure, keeping the design uniform.
  • Faster Page Creation — No need to manually build layouts every time. Just select a template and start adding content.
  • Less Developer Dependency — Authors don't have to rely on developers for minor changes.
  • More Control Over Content — Developers can enforce structure, while authors can still modify content as needed.
  • Scalability — When managing large websites, templates make it easier to create and maintain hundreds -or thousands- of pages.

Types of AEM Templates

AEM has two main types of templates: Static Templates and Editable Templates. Both have their purpose

Static Templates — The Developer-controlled structures

Static templates are the traditional templates that have been used in AEM. If you've worked with older versions of AEM, you've probably come across them. These templates are fully managed by developers, meaning content authors can't change their structure.

Here's how they work

  • Defined in Code — Everything is stored in the JCR -/apps folder-, and updates require a developer.
  • Fixed Structure — What you see is what you get. Authors can't re-arrange or add new components.
  • No Built-in Responsiveness — Developers have to manually code how the template adapts to different screen sizes.
  • Used for Strictly Controlled Pages — Ideal when you don't want authors changing layouts.

A static template is typically stored as a .content.xml file, which includes details like

  • The resource type of the page component
  • Default components -e.g., header, footer, paragraph system)
  • Any restrictions on what authors can do

Once a page is created from a static template, it's copied into the JCR, meaning any future changes to the template won't affect existing pages.

Editable Templates — More Flexibility for Authors

AEM introduced Editable Templates in version 6.2 to give authors more control. Unlike static templates, these can be modified without a developer's help using the Template Editor.

Why use editable templates?

  • Flexible & Author-Friendly — Authors can update layouts, add new components, and control page structure.
  • Template Policies — Developers can still define rules e.g., what components are allowed for the template.
  • Responsive by Default — Works well across different screen sizes without extra coding.
  • Live Updates — Changes to the template structure immediately reflect on all pages using that template.

Editable templates don't exist in /apps like static templates. Instead, they are stored under /conf, making them easier to manage without touching code.

Which One Should You Use?

  • If you need a strictly controlled page structure that won't change, go with Static Templates.
  • If you want more flexibility for authors and easier page management, Editable Templates are the way to go.

Key Components of an AEM Template

  • Template Type: Defines the base structure.
  • Policies: Control design and behavior of components.
  • Initial Content: Predefined content structure.
  • Structure: Defines the layout and components.
  • Content Policies: Define allowed components and their configurations.
  • Page Policies: — Defining Page-wide Rules

Editable Template Workflow & Pages Relationship

Editable templates in AEM work in a way where both developers and template authors have their roles. Developers set up the structure, and authors use that to create templates that content creators can work with creating pages.

Developer Responsibilities

Page Component

  • Acts as the base for templates, containing scripts and configurations needed for functionality.

Template Type

  • Developers create this using the page component. It defines the basic structure that template authors will use

Author Responsibilities

Template

  • Created by template authors using a template type.
  • Define layout settings, pre-existing components, and content structure.
  • Static connection with the template type → Changes in the template type do not affect already created templates.

Pages

  • Generated from templates and inherit the predefined structure.
  • Contain layouts and components set at the template level.
  • Dynamic connection with templates → Any updates in a template are reflected on all associated pages. -

Dynamic Relationship.

  • Templates dynamically influence the pages created from them e.g., layout or component updates in a template reflect on all associated pages.

Hierarchy Summary.

  • Template Type → Creates → Templates.
  • Templates → Generate → Pages.
  • Each layer impacts the next directly, with dynamic changes only applicable from template to pages.

How to Create an Editable Template in AEM

Step 1: Create a Folder for Templates

  • This step is optional but highly recommended to keep things organized.
  • Go to Tools → General → Configuration Browser.
AEM Template
AEM Template

Click on Create Configuration and fill in:

  • Title → Provide a name for the configuration folder.
  • Enable Editable Templates → Check this option
AEM Template
AEM Template

Click Create Button → Now the folder is created

AEM Template
AEM Template

Step 2: Verify Folder Creation in CRX/DE

  • Open CRX/DE and check if the newly created folder is stored correctly
AEM Template
AEM Template
  • Inside this folder, there will be a sub-folder named Template Type -it will be empty at first-.
AEM Template
AEM Template

Step 3: Create a Template Type

  • Go to Tools → General → Template Folder.
AEM Template
AEM Template
  • Now you will be able to see the folder which is created earlier.
AEM Template
AEM Template
  • Go inside the folder and Click on the Create Button.
AEM Template
AEM Template

You will find one template type that is coming from another resource. For example, it will check in the relative path if the template type is not available in our project.

  • /conf/myproject/myproject/settings/wcm/template-types
  • /conf/myfolder/settings/wcm/template-types
  • /conf/global/settings/wcm/template-types
  • /apps/settings/wcm/template-types
  • /libs/settings/wcm/template-types
  • Instead of creating a new one from scratch, you can copy an existing template type from another project -e.g., the WKND project-.
AEM Template
AEM Template
  • Paste it into your folder under template-types and rename the file accordingly.
AEM Template
AEM Template

Step 5: Modify the Template Type

  • Inside the copied template type folder
  • Update jcr:content → Change jcr:title and jcr:description.
AEM Template
AEM Template
  • Go to the initial content node → Update sling:resourceType to match the correct page component.
AEM Template
AEM Template
  • Go to structure node → Update sling:resourceType to refer to the correct page structure
AEM Template
AEM Template
  • Now, the template type is ready!

Step 6: Create a Template Using the Template Type

  • Go to Tools → General → Templates → Open Your Project Folder.
  • Click Create and choose the template type you just created.
AEM Template
AEM Template
  • Select the template type and create a template
  • Give a title
AEM Template
AEM Template
  • Once you add the title click on Create button
AEM Template
AEM Template
  • The template is successfully created and now you can use it for page creation.

Understanding the Editable Template Structure

Template Type -cq: Template-

Template Type is like a blueprint for making a pre-defined template. It defines the base structure, allowed components, and any default content that should be included when a new page is created.

It contains several key configurations:

  1. initial
  • This defines any pre-filled content that will automatically appear when a new page is created using a template.
  • Example: If you want every new page to start with a banner at the top, you can define it here so authors don't have to add it manually.
  1. jcr:content
  • This is where the template type's settings and metadata are stored. Think of it as the template's control panel.

What it contains

  • Title -jcr:title- → The display name of the template type.
  • Description -jcr:description- → A short explanation of what this template type is for.
  • Resource Type -sling:resourceType- → Links to the page component that defines the template's core structure.
  • Other settings → Defines layout rules, allowed components, and other configurations that control how the template behaves.
  1. structure
  • The structure node defines the layout and fixed components for templates. once you add something to this structure node cannot be modified or removed by authors, when creating pages.

What it does

  • Defines the static layout of the template.
  • Locks certain components that should always be present -like a header or footer-.
  • Ensures consistency across pages using the same template.

Example: If every page must have a company logo in the header and a copyright footer, you define those here. Authors won't be able to remove or edit them.

  1. policies
  • The policies define the design of the properties of a component, These apply to the template and page created using this template.
  1. thumbnail.png: Represents the template visually in the UI.

Template -cq:Template and cq:templateType.

A Template is created using a Template Type as its base. It provides the structure and rules for pages. When an author creates a new page, they select a template, which defines how the page is set up.

similar structure

  • initial: Used to define editable components and content available at page — creation.
  • jcr:content: Contains metadata and template-specific details.
  • structure: Layout and fixed components that cannot be removed.
  • policies: Restrictions and permissions for components.
  • thumbnail.png: Visual representation of the template in the interface.

Static and Dynamic Reference.

  • Template Type ↔ Template: Static reference; changes in the template type do not affect existing templates.
  • Template ↔ Pages: Dynamic reference; changes in the template reflect on all pages created using that template.

--templates stored under /conf--

Structure Tab vs Initial Content Tab

Open your template which created.

AEM Template
AEM Template

Structure Tab in AEM Templates

The Structure tab in AEM is where you set up the main parts of a template. It decides what will always be there when someone creates a page using this template.

What happens in the Structure tab?

  • You add components that should not be removed, like headers or footers.
  • If a component is locked, page authors cannot delete or move it.
  • If a component is unlocked, it becomes editable when the page is created.
  • Any changes made in the Structure tab will apply to all pages based on this template.

Initial Content Tab in AEM Templates

The Initial Content tab is where you define the default content that will be there when someone creates a new page from the template. Unlike the Structure tab, this content can be changed or removed by the page author.

What happens in the Initial Content tab?

  • You add components that will be pre-filled on new pages.
  • Page authors can edit or delete these components.
  • It helps speed up content creation by providing a starting point.

Difference Between Structure Tab and Initial Content Tab

  • Both the Structure tab and Initial Content tab allow adding components to a template, but they serve different purposes.
AEM Template
AEM Template

Example Scenario

Imagine you are creating a Product Page template

  • Structure tab: You add a header, footer, and sidebar -these should always be there and cannot be removed-.
  • Initial Content tab: You add a product description and an image placeholder -authors can replace these-.

Creating Page Using Template

  • Go to this URL → http://localhost:4502/sites.html/content/<your_Project>/us/en
  • Click on Create and select Template
AEM Template
AEM Template
  • you need to find your template in it. if your template is not visible
  • The template is in draft mode
  • Template is not allowed

Let's make the template from the draft to enable state.

AEM Template
AEM Template

After enabling still you are still not able to find the template

AEM Template
AEM Template

Next, you add in page properties under US → page properties

AEM Template
AEM Template

once you add it, you will find your template when you are creating a page.

AEM Template
AEM Template

let's create a page using this template.

AEM Template
AEM Template

We have successfully created a page using template.

Key Takeaways

  • Templates define page blueprints that ensure consistency across large websites
  • Static Templates provide developer-controlled structures (legacy approach)
  • Editable Templates provide author-friendly flexibility with governance (modern approach)
  • Template Types act as the base for creating templates
  • Structure Tab defines locked components that cannot be removed
  • Initial Content Tab defines pre-filled content that authors can modify
  • Templates enable rapid page creation without requiring developer involvement
  • Templates dynamically affect pages — changes to templates reflect on all pages using them
  • Governance at scale — templates are the key to maintaining consistency across hundreds or thousands of pages

What Happens Next?

In this chapter, we learned how templates define the blueprint from which pages are created.

Now that you understand both components (Chapter 7) and templates (Chapter 8), you have the core knowledge of AEM's page architecture.

The next chapters explore how pages are structured and styled:

  • Chapter 9: Layout Container & Responsive Grid — How pages adapt to different devices

You now have the foundational knowledge needed to create and manage templates that enable enterprise-scale content creation with consistency and governance.

Enjoyed this chapter?

Get an email when I publish the next chapter. No spam — just new technical deep-dives.