How do you add an Experience Fragment template? | Community
Skip to main content
New Participant
September 13, 2022
Solved

How do you add an Experience Fragment template?

  • September 13, 2022
  • 3 replies
  • 1756 views

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?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Saravanan_Dharmaraj

Please check this post. It has the latest update too.

https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/how-to-create-experience-fragments-template/m-p/303444 

3 replies

Ankur_Khare
New Participant
September 14, 2022

Hi,

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.

Regards 

Ankur

 

 

B_Sravan
New Participant
September 14, 2022
  • 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.

Saravanan_Dharmaraj
Saravanan_DharmarajAccepted solution
New Participant
September 13, 2022
New Participant
September 14, 2022

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.