Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events

How do you add an Experience Fragment template?


Level 2

Our team is currently looking into building a proof of concept experience fragment that we can test in different subsites to see how it will render. I've been looking for information on how to add an existing page template as an experience fragment or how to create a new one, but what I've tried so far hasn't added the template.

Is there any documentation or otherwise about how to do this?

1 Accepted Solution


Correct answer by
Community Advisor
4 Replies


Correct answer by
Community Advisor

Thanks! I did see that post, but I was able to piece together what needs to be done:


  1. Create a copy of a page template in /conf/<project-name>/settings/wcm/templates/
  2. Renamed to experience-fragment-web-variation
  3. Go to /content/experience-fragments/
  4. Add /conf/<project-name>/settings/wcm/templates/experience-fragment(.*)? to cq:AllowedTemplates

I think the difference that made this a little confusing is that our team is utilizing a custom page template type for the page templates.

Also, while these posts are helpful, I feel like I'm only getting half of the information regarding how to work with experience fragment templates. It would be nice if Adobe provided a bit more documentation here for this.


Community Advisor
  • if you are using an archetype generated project, you can create a experience fragment template at http://localhost:4502/libs/wcm/core/content/sites/templates.html/conf just as you create a usual editable page template. While choosing the template type, select the experience fragment type.
  • Other wise, create a folder(lets name is sampleProject) under configuration browser with editable templates checkbox checked.
    go back to http://localhost:4502/libs/wcm/core/content/sites/templates.html/conf and create a template under "sampleProject" and leave it raw. Now go to crx de, copy the newly created to "/conf/sampleProject/settings/wcm/template-types/<newly-created-template>" and name this as experience fragment template. Now You can create XF template similar to page template and add new template in cq:allowedTemplates property at /content/experience-fragments.


I hope this helps, 

Thank you.


Community Advisor


If you have created your project using archtype there must be a template already created you can refer the same to create a new one.

So to create a new xf template it's similar to templates just that page template would be used to create new xf template.

Refer wknd code as well.