Expand my Community achievements bar.

SOLVED

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

Avatar

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

Avatar

Correct answer by
Level 10

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

Avatar

Correct answer by
Level 10

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

Avatar

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

Avatar

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'}"/>