Create Custom Template for Experience Fragment in AEM

Hello everyone,
In this post we will see how to create custom template for Experience Fragment.

Note : Here I am using the same BasePage Component for experience fragment template and for page template.

Step 1: Go to CRXde and create a Simple Component with Parsys only.

Stet 2:  Navigate to /conf/we-retail/settings/wcm/templates and start creating Template.
sling:resourceType:/apps/blog/component/BasePage




Step 3: Once template is created you have to allow this template under /content/experience-fragments

To allow your custom template under /content/experience-fragments navigate /content/experience-fragments this folder will have property cq:allowedTemplates  edit property and add path of your custom template (/conf/we-retail/settings/wcm/templates/Sample).



Step 4: Now start creating Experience fragment using custom template.






Step 5: Once Experience fragment is created author it i.e. author the required component/ content that you want to re-use in multiple pages or site.

To author XF Navigate to XF that you have created select the experience fragment (for me SampleXF). 

Click Edit


In XF author the required component/content. Here I have authored a column divider component with 3 columns. In each column again I have authored other component which I want to re-use on my page.

Step 6: Now you can use this Experience fragment on required pages.

To use XF on page 1st add Experience Fragment Component from general group on page. Then configure it with your XF which is created using custom template.
To configure XF give path of your XF in Variation( in my case /content/experience-fragments/en/LearnAEM/samplexf/samplexf) 


That's it your XF is configured on page.


KEEP EDUCATING YOURSELF!!!

Comments

Popular posts from this blog

AEM in docker

Sling API vs JCR API

Creating or finding .M2 folder