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
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

How to add components to a template without actually adding from the sidekick?

ramanareddy438
Level 2
Level 2

Hi All,

I want to preload the components in a template before displaying the page. I can add the components to template from the sidekick but I don't want to do it that way. I am newbee to Adobe AEM/CQ5. Please help me out with an example.[img]preload-template.png[/img]

There is an answer in this URL but it is not working as expected. http://stackoverflow.com/questions/22392147/cq5-preload-a-parsys-with-components#answers-header

Please let me know if any more information is needed.

Thanks in Advance

1 Accepted Solution
Lokesh_Shivalingaiah
Correct answer by
Community Advisor
Community Advisor

Hi,

In your page component for a particular template add the below snippet to include the component directly

<cq:include path="<component name>" resourceType="<component path>"/>

ex: <cq:include path="header" resourceType="abc/components/header"/>

This will load the header directly in the template. Similarly you can include any component

View solution in original post

3 Replies
Lokesh_Shivalingaiah
Correct answer by
Community Advisor
Community Advisor

Hi,

In your page component for a particular template add the below snippet to include the component directly

<cq:include path="<component name>" resourceType="<component path>"/>

ex: <cq:include path="header" resourceType="abc/components/header"/>

This will load the header directly in the template. Similarly you can include any component

View solution in original post

ramanareddy438
Level 2
Level 2

Thanks for the reply. This way it won't get displayed on the page directly. Correct me if I am wrong. This will add the component to sidekick from there we can add to page. But I want to display the component on the page directly.

 

Regards

M. Ramana Reddy

ramanareddy438
Level 2
Level 2

Thank you very much. That did work. But I did it in sightly.

<div data-sly-resource="${@path='<component_name>', resourceType='<path/to/component'}"/>