Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

What is the use of TemplatedContainer (data-sly-use.templatedContainer)

Avatar

Avatar
Validate 10
Level 2
tushaar_srivastava
Level 2

Likes

8 likes

Total Posts

91 posts

Correct Reply

0 solutions
Top badges earned
Validate 10
Validate 1
Ignite 3
Ignite 1
Give Back 5
View profile

Avatar
Validate 10
Level 2
tushaar_srivastava
Level 2

Likes

8 likes

Total Posts

91 posts

Correct Reply

0 solutions
Top badges earned
Validate 10
Validate 1
Ignite 3
Ignite 1
Give Back 5
View profile
tushaar_srivastava
Level 2

04-05-2020

I tried to find an Adobe post related to TemplatedContainer.

Could you please help me what is TemplatedContainer, as we have to use this in Editable Template.

 

I have seen many code snippet like below: 

<sly data-sly-use.templatedContainer="com.day.cq.wcm.foundation.TemplatedContainer"
data-sly-repeat.child="${templatedContainer.structureResources}"
data-sly-resource="${child.path @ resourceType=child.resourceType, decorationTagName='div'}"/>

 But don't know what is this and what and where is the use of TemplatedContainer

 

@kautuk_sahni  @Arun_Patidar 

AEM6.3.0 Editable templates TemplatedContainer
View Entire Topic

Avatar

Avatar
Establish
MVP
Veena_Vikram
MVP

Likes

470 likes

Total Posts

1,039 posts

Correct Reply

121 solutions
Top badges earned
Establish
Coach
Contributor 2
Seeker
Ignite 5
View profile

Avatar
Establish
MVP
Veena_Vikram
MVP

Likes

470 likes

Total Posts

1,039 posts

Correct Reply

121 solutions
Top badges earned
Establish
Coach
Contributor 2
Seeker
Ignite 5
View profile
Veena_Vikram
MVP

04-05-2020

@tushaar_srivastava This is what I understand about this API. Since there is not much documentation on how the API works and what each method actually does, I did some research. So basically the api helps to resolve your templates , structure node. Lets take an example of the WKND pages ( the sample project )

So lets say I have a page best-tacos-in-the-city.html This page is defined using article-page-template . Now for the article page template , you have a structure node , where the structure of your template is defined and the node structure for the same would be as below

 
 

wknd.JPG  

TemplatedContainer API helps you to fetch these structure nodes or to check if the template has a structured content and its inherited methods from WCMPojo helps with a lot of other page and resource methods. Please check https://helpx.adobe.com/experience-manager/6-5/sites/developing/using/reference-materials/javadoc/co...

 

Coming back to the structuredResource , 

<sly data-sly-use.templatedContainer="com.day.cq.wcm.foundation.TemplatedContainer"
data-sly-list.child="${templatedContainer.structureResources}">

If you try to print and check ${child.path} , you can see that it resolves to the structure content node, in this case /conf/wknd/settings/wcm/templates/article-page-template/structure/jcr:content/root

 

 

templated-container.JPG

 

In line 18 of the above body.html , when the child.path is included as a resource , you are actually including the "/conf/wknd/settings/wcm/templates/article-page-template/structure/jcr:content/root" node as a resource and that way all the below resources of the root node will get included to your page. 

 

Hope this helps. Let me know if you have any more questions.

 

Thanks

Veena