How to add components to a template without actually adding from the sidekick? | Community
Skip to main content
ramanareddy438
New Participant
October 16, 2015
Solved

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

  • October 16, 2015
  • 3 replies
  • 1086 views

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

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Lokesh_Shivalingaiah

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

3 replies

Lokesh_Shivalingaiah
Lokesh_ShivalingaiahAccepted solution
New Participant
October 16, 2015

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

ramanareddy438
New Participant
October 16, 2015

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
New Participant
October 16, 2015

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

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