Wasim's Site

AEM Editable Template Builder

Generate AEM editable template XML — page structure, layout container, structure components, and the allowed-components policy.

Template

Structure Components (locked, predefined)

Allowed Components (layout container policy)

One resource type per line. These become the components list authors can drop into the layout container.

structure/.content.xml

Goes under /conf/myproject/settings/wcm/templates/content-page/structure/.content.xml

Layout container policy .content.xml

A policy node (under /conf/myproject/settings/wcm/policies/...) listing the allowed components.

Note: editable templates also need a policies/.content.xml mapping and an initial/.content.xml. AEM creates those automatically when you build the template in the Template Editor — this tool generates the two files developers most often edit by hand: the structure and the allowed-components policy.

Scaffolding AEM Editable Templates

Editable templates are the modern way to build AEM Sites pages, but the underlying JCR structure — the cq:Page with its structure, initial, and policies nodes, plus the responsive-grid layout container and content policies — is verbose to author by hand. This builder generates the two pieces developers most commonly edit in code: the structure .content.xml and the layout container policy that lists allowed components.

What Gets Generated

  • structure/.content.xml: the page structure with a root responsive-grid container, breakpoints, and any locked structure components you add.
  • policy .content.xml: a layout container policy whose components property lists the resource types authors may drop into the page.

How to Use This Builder

  1. Set the template info: project, template node name, title, and the page + container resource types.
  2. Add structure components: locked components like a header or footer that appear on every page.
  3. List allowed components: one resource type per line for the layout container policy.
  4. Copy or download: place the files under /conf/<project>/settings/wcm/ in your code package.

Frequently Asked Questions

What is an AEM editable template?
An editable template defines the structure, initial content, and authoring policies for pages — and template authors can create and edit it through the Template Editor (no developer required). Pages keep a dynamic link to the template, so structure changes propagate to existing pages.
What files does this tool generate?
Two: the structure/.content.xml (the cq:Page structure with the root layout container and any locked structure components), and a layout container policy .content.xml listing the components authors are allowed to drop in. These are the two files developers most often edit by hand.
Where do editable templates live in the repository?
Under /conf/<project>/settings/wcm/templates/<template-name>/, with the structure, initial, and policies child nodes. Policies themselves live under /conf/<project>/settings/wcm/policies/. This tool builds the cq:template path for you from your project and template names.
What is the difference between structure and initial content?
Structure components are locked — they always appear on every page and authors cannot remove them (e.g. a header or footer). Initial content is unlocked and editable per page. Locking and unlocking is toggled in the Template Editor; this generator outputs the structure tree as the starting point.
How do allowed components work?
A content policy on the layout container holds a components property — a list of resource types authors may add. The generated policy XML includes that list so you can version it in code instead of clicking through the UI.

Official Resources