Reusability of same authored component | Community
Skip to main content
Mohit1
Level 2
December 5, 2022
Solved

Reusability of same authored component

  • December 5, 2022
  • 4 replies
  • 1806 views

So I want to refer to the component which we have created as part of one of the pages and render the same content with the same authored data on another page, how can this be achievable?

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 Mani_kumar_

For different approach, follow the below steps

  1. Create a data page and create component with all the fields that needs to be reused
  2. Create a custom components with pathbrowser, configure that to the data page
  3. Read the resource in the custom components and inject the resource properties
  4. Apply styles and conditions required for the custom component and display the values from datapage.

Hope this is helpful

4 replies

B_Sravan
Community Advisor
Community Advisor
December 5, 2022

yes. The best way to deal with this is with an experience fragment.

More on experience fragment: https://experienceleague.adobe.com/docs/experience-manager-64/authoring/authoring/experience-fragments.html?lang=en

Mohit1
Mohit1Author
Level 2
December 5, 2022

Thank you for your comment.

But I am not looking for an experience fragment way, Any other suggestion would be much appreciated.

B_Sravan
Community Advisor
Community Advisor
December 6, 2022

if not with experience fragments, you'll have to deal with this in a complex way.

At the moment I could think of creating a data node where you have all the content in the jcr:content properties – from your custom component read these properties from the node from your sling model and display them on dragging it. The only thing here is you figure out how you wanna author this data node.

I would still recommend using Experience Fragments to keep it simple and author-friendly.

Mani_kumar_
Community Advisor
Community Advisor
December 5, 2022

Create an experience fragment page and configure the required component on that page.

Then configure the experience fragment component where ever it is required and same content is displayed at all the places where it configured.

Please refer this documentation for information on Experience fragments.

https://experienceleague.adobe.com/docs/experience-manager-64/authoring/authoring/experience-fragments.html?lang=en

Hope this is helpful

Mohit1
Mohit1Author
Level 2
December 5, 2022

Thank you for your comment.

But I am not looking for an experience fragment way, Any other suggestion would be much appreciated.

Mohit_KBansal
Adobe Employee
Adobe Employee
December 5, 2022

Earlier AEM had Reference Paragraph [1] component, which was removed from the Touch UI interface, and AEM Introduced a more flexible way to manage and use shared content, called Experience Fragments [2].

You should create xFragments for the content that is reusable, and use the Experience Fragment core component [3] on your page to refer to experience fragment.

[1] https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/touch-ui-paragraph-reference/m-p/254098

[2] https://experienceleague.adobe.com/docs/experience-manager-learn/sites/experience-fragments/experience-fragments-feature-video-use.html

[3] https://experienceleague.adobe.com/docs/experience-manager-core-components/using/wcm-components/experience-fragment.html

Mohit1
Mohit1Author
Level 2
December 5, 2022

Hi @mohit_kbansal ,

Thank you for your comment.

But I am not looking for an experience fragment way, Any other suggestion would be much appreciated.

Community Advisor
December 5, 2022

Hi @mohit1

If you are not looking for an experience fragment way, I would recommend you to use the content fragment.

Refer :- Adobe Experience Manager Help | Working with Adobe Experience Manager Content Fragments

Thanks

Mani_kumar_
Community Advisor
Mani_kumar_Community AdvisorAccepted solution
Community Advisor
December 5, 2022

For different approach, follow the below steps

  1. Create a data page and create component with all the fields that needs to be reused
  2. Create a custom components with pathbrowser, configure that to the data page
  3. Read the resource in the custom components and inject the resource properties
  4. Apply styles and conditions required for the custom component and display the values from datapage.

Hope this is helpful