Expand my Community achievements bar.

SOLVED

How to reuse created component resources to render a page

Avatar

Level 2

I add a component in one page. For instance, I drag and drop a Text & Image component.I edit that component with some texts and an image. Now, I need to reuse that created Text & Image component resource to render another page so that the same content can display automatically when the second page opens.There should be an easy way to achieve that, but I didn't figure it out. Any helps?

Thanks and regards,

Yy

1 Accepted Solution

Avatar

Correct answer by
Level 10

You can use OOTB reference component, drag this component where you want to refer previous author component

Take a look @ https://docs.adobe.com/docs/en/cq/5-6/wcm/default_components.html#Reference

View solution in original post

5 Replies

Avatar

Correct answer by
Level 10

You can use OOTB reference component, drag this component where you want to refer previous author component

Take a look @ https://docs.adobe.com/docs/en/cq/5-6/wcm/default_components.html#Reference

Avatar

Level 10

As Praveen pointed out - you can use the Reference component. BUt if you do this and make a change - the change appears in the other page. When authoring pages - i prefer a 1-1 model. Each page has its own component so a change made in page 1 will not affect page 2. 

Avatar

Level 2

Is it possible to load created resources programmatically without manually dragging components to the pages? The page will dynamically display the component content based on the backend business logic.

Thanks,

Yy

Avatar

Level 10

You can use

<cq:include path="path to your component node" resourceType="script that will render the componet example [1]" />

[1] apps/project/component/text

Avatar

Level 2

Yeah, that's exactly what I need. Thank you and Scott very much for your help.

Yy