Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

AEM 6.3 Experience Fragments

Avatar

Level 3

The AEM Experience Fragments can be created with pre-built templates like Html, Facebook, We-Retail. It is does not provide a design mode option to select my custom components.

https://docs.adobe.com/docs/en/aem/6-3/author/experience-fragments.html

How do I use my custom components in designing/building an experience fragment? Can I create a custom template and use it in creating an experience fragment? Or the last available option is to use a layout container and use it in creating an experience fragment.

Thanks in advance for any suggestions.

1 Accepted Solution

Avatar

Correct answer by
Administrator

Hi,

This is really a nice question. Let me answer it 1 by 1:

How do I use my custom components in designing/building an experience fragment?

We can not this directly. As the user who is creating the Experience fragment should not be having rights to configure the allowed components.

Can I create a custom template and use it in creating an experience fragment? Or the last available option is to use a layout container and use it in creating an experience fragment.

Yes, this should be the approach.

Step1:-

We should create an Editable template "Tools> General > Templates" and therein layout container we can configure policies (here we can configure which all component groups to be included or excluded) and later use this templates for creating Experience fragment

Step2:- Enable this template and later use this templates for creating Experience fragment

Step3:- In CRX/de go to /content/experience-fragments and in cq:allowedTemplates add the path of newly created Template in step 1. Now you are good to go. Now when you create

PS:- You can avoid Step 2 and 3 and can directly use We-retail template available. Just change policy as per your need.

Tested now, working fine.

~kautuk



Kautuk Sahni

View solution in original post

6 Replies

Avatar

Correct answer by
Administrator

Hi,

This is really a nice question. Let me answer it 1 by 1:

How do I use my custom components in designing/building an experience fragment?

We can not this directly. As the user who is creating the Experience fragment should not be having rights to configure the allowed components.

Can I create a custom template and use it in creating an experience fragment? Or the last available option is to use a layout container and use it in creating an experience fragment.

Yes, this should be the approach.

Step1:-

We should create an Editable template "Tools> General > Templates" and therein layout container we can configure policies (here we can configure which all component groups to be included or excluded) and later use this templates for creating Experience fragment

Step2:- Enable this template and later use this templates for creating Experience fragment

Step3:- In CRX/de go to /content/experience-fragments and in cq:allowedTemplates add the path of newly created Template in step 1. Now you are good to go. Now when you create

PS:- You can avoid Step 2 and 3 and can directly use We-retail template available. Just change policy as per your need.

Tested now, working fine.

~kautuk



Kautuk Sahni

Avatar

Level 2

kautuksahni

So I'm looking at the documentation for creating Experience Fragments And I want to create a fragment from a custom template; the same way the we-retail sample project does.

So I go about creating a template, they try to create my fragment from that template only to find that my template does not show up as one of the options... ok.. I look into how we-retail did it and I copy the web variation template to my own directory under /conf.. still not working..

At this point, I do a google search and I arrive here.. and I see you are mentioning that you need to add the location of the template to the cq:AllowedTemplates prop of the node /content/experience-fragments.

Now I have two questions:

1. Why is this not documented in the official documentation? The whole point is to be able to create your own templates and fragments, right? So the use of  cq:AllowedTemplates prop of the node /content/experience-fragments should be well documented.

2. How is the we-retail sample implementation adding the path to cq:AllowedTemplates automatically? I can see this entry added to cq:AllowedTemplates: `/conf/we-retail/settings/wcm/templates/experience-fragment(.*)?` But I dont see where in the we-retail code it's being added?

Thanks!

Avatar

Level 2

kautuksahni​ any updated on this? I'd really like to know how I can do this correctly. Thanks!

Avatar

Level 1

In AEM 6.4 this is available in Touch UI on Experience Fragment folder and from there you can add new template path.

Avatar

Level 2

oh, I see it now, it's a little button with a "cog" icon on the top right corner of http://localhost:4502/aem/experience-fragments.html/content/experience-fragments

Still my concern remains.. it is not documented.

Avatar

Level 2

I have faced the same thing that ahmedmusallam​ has faced. It ll be great if documented. Ignore this comment if already done.

kautuksahni