Expand my Community achievements bar.

SOLVED

cq:template values are not rendering

Avatar

Level 2

<div data-sly-resource="${'inlinesubscribe' @ resourceType='abc/components/content/inlinesubscribe'}"></div>
<div data-sly-resource="${'inlinesocial' @ resourceType='abc/components/content/inlinesocial'}"></div>

im adding this code to configure inlinesubscribe and inlinesocial component inside another component.. these two components is having cq:template default values.
but those are not rendering if i add it inside another component.
individually its working fine.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @SudarshanV1 

It will not work if component is embedded within another component.

In this case you need to add cq:template to parent component with content structure e.g.

https://github.com/arunpatidar02/aemaacs-aemlab/blob/master/ui.apps/src/main/content/jcr_root/apps/a... 



Arun Patidar

View solution in original post

3 Replies

Avatar

Community Advisor

Hi @SudarshanV1 

Use data-sly-include Instead
Replace data-sly-resource with data-sly-include to include rendered content with default properties:

 

<div data-sly-include="${'/content/path/to/inlinesubscribe' @ resourceType='abc/components/content/inlinesubscribe'}"></div>
<div data-sly-include="${'/content/path/to/inlinesocial' @ resourceType='abc/components/content/inlinesocial'}"></div>

 

Pass Default Properties Manually
If defaults aren’t applied, explicitly pass them in data-sly-resource:

 

<div data-sly-resource="${'inlinesubscribe' @ resourceType='abc/components/content/inlinesubscribe', prop1='default1'}"></div>
<div data-sly-resource="${'inlinesocial' @ resourceType='abc/components/content/inlinesocial', prop1='default1'}"></div>

 

Check Policies & Resource Inheritance
Ensure proper template policies and sling:resourceSuperType for both components.

Debug Properties
Use ${properties @ context='json'} in the child components to verify passed values.

Please let me know if you need further help 

Thanks

Partyush

 



 

Avatar

Level 2

Is the parent component a container component? Refer this for including a component inside another component - https://medium.com/@arunpatidar26/cq-iscontainer-property-in-aem-94e5318e04fa

 

Avatar

Correct answer by
Community Advisor

Hi @SudarshanV1 

It will not work if component is embedded within another component.

In this case you need to add cq:template to parent component with content structure e.g.

https://github.com/arunpatidar02/aemaacs-aemlab/blob/master/ui.apps/src/main/content/jcr_root/apps/a... 



Arun Patidar