Expand my Community achievements bar.

SOLVED

How to pull data from authored component into another component?

Avatar

Level 2

I have two components in separate pages. I want to show the authored data of component 1 in component 2. Is there someway we can achieve this without the creation of a content api? If possible is it possible to pull the entire htl of component 1 in component 2?

Preferably using HTL itself?

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi, 

 

Short answer: No, each component will store its content (configs/data) individually, so it is not shareable. However, there are several ways to accomplish this. One approach is to have a "source of truth" from which you can pull data to feed into Component 1 or Component 2. You could retrieve this data using a Sling Model, API, OSGi Service, etc.

Taking this approach involves several considerations, such as where to store the data, what types of structures to use, and who will have access. If you choose this route, you might also explore Content Fragments, which can help you determine where and how to store content for consumption.

Depending on the relationship between Component 1 and Component 2 in the content tree, there may be additional options to explore for inheriting properties that may also be accessible through HTL, you can see more in the references section at the bottom.

Another option is to use Experience Fragments (XF), which can be reused across pages. You can also check if the variations concept works for you.

 

There is no definitive answer, as the decision should be based on your specific requirements and needs.



Here are some references that you can take a look:

- https://experienceleague.adobe.com/en/docs/experience-manager-65/content/sites/authoring/authoring/e...

https://sourcedcode.com/blog/aem/aem-quick-reference/aem-inheritedpageproperties-with-sightly-jsp-os... 

https://medium.com/@veena.vikraman19/inherit-properties-from-parent-pages-in-aem-9ab41f9d98dc 

https://adobe-consulting-services.github.io/acs-aem-commons/features/shared-component-properties/ind... 

https://experienceleague.adobe.com/en/docs/experience-manager-65/content/assets/content-fragments/co... 

 

Hope this helps

 

 



Esteban Bustamante

View solution in original post

2 Replies

Avatar

Community Advisor

Hi @Zendarkke ,

Use experience fragment in this scenario so that you can drive content display at multiple places from single source.

 

Thanks

 

Himanshu Jain

Avatar

Correct answer by
Community Advisor

Hi, 

 

Short answer: No, each component will store its content (configs/data) individually, so it is not shareable. However, there are several ways to accomplish this. One approach is to have a "source of truth" from which you can pull data to feed into Component 1 or Component 2. You could retrieve this data using a Sling Model, API, OSGi Service, etc.

Taking this approach involves several considerations, such as where to store the data, what types of structures to use, and who will have access. If you choose this route, you might also explore Content Fragments, which can help you determine where and how to store content for consumption.

Depending on the relationship between Component 1 and Component 2 in the content tree, there may be additional options to explore for inheriting properties that may also be accessible through HTL, you can see more in the references section at the bottom.

Another option is to use Experience Fragments (XF), which can be reused across pages. You can also check if the variations concept works for you.

 

There is no definitive answer, as the decision should be based on your specific requirements and needs.



Here are some references that you can take a look:

- https://experienceleague.adobe.com/en/docs/experience-manager-65/content/sites/authoring/authoring/e...

https://sourcedcode.com/blog/aem/aem-quick-reference/aem-inheritedpageproperties-with-sightly-jsp-os... 

https://medium.com/@veena.vikraman19/inherit-properties-from-parent-pages-in-aem-9ab41f9d98dc 

https://adobe-consulting-services.github.io/acs-aem-commons/features/shared-component-properties/ind... 

https://experienceleague.adobe.com/en/docs/experience-manager-65/content/assets/content-fragments/co... 

 

Hope this helps

 

 



Esteban Bustamante