In AEM 6.3, how to re-use component content on multiple pages

Avatar

Avatar

karanmahi

Avatar

karanmahi

karanmahi

18-04-2019

In AEM 6.3, I have "List component" which has already been authored on the page. Is there any way we can use the same component content on some other page without dragging-and-dropping the List component again. Basically, we would like to re-use the same component data on other pages without re-authoring just to save time and effort. Any pointers will be highly appreciated.

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar

Arun_Patidar

MVP

Total Posts

2.9K

Likes

1.0K

Correct Answer

831

Avatar

Arun_Patidar

MVP

Total Posts

2.9K

Likes

1.0K

Correct Answer

831
Arun_Patidar
MVP

18-04-2019

Inheritance

it is implemented by components like the iparsys or by using the InheritanceValueMap of Sling. In this case the reference target is always the parent (page/node). This approach is helpful when you want to inherit content down the tree (e.g from the homepage of the site to all individual pages); with the iparsys it’s hte content of a parsys, with the InheritanceValueMap it’s properties.

e.g. https://javaecm.com/tag/iparsys/

Reference

it is implemented by data-sly-resource attribute in HTL similar to sling include, this includes the result of rendering the indicated resource through the sling resolution and rendering process.

e.g.

<article data-sly-resource="${ @ path='path/to/resource'}"></article>

more info

https://docs.adobe.com/content/help/en/experience-manager-htl/using/htl/block-statements.html

Answers (5)

Answers (5)

Avatar

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Answer

2.3K

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Answer

2.3K
smacdonald2008

18-04-2019

That will get messy as each page has its own props that populate the components.  If you want to use same content on other pages - you should look at EFs or even Content Fragments - not try and reuse a component set in Page A on Page B.

Avatar

Avatar

karanmahi

Avatar

karanmahi

karanmahi

18-04-2019

I understand Content Fragments and Experience Fragments and custom implementation too. Can you please put some more context on below too. If possible please share some examples.

  • By Reference
  • By inheritance

Avatar

Avatar

Arun_Patidar

MVP

Total Posts

2.9K

Likes

1.0K

Correct Answer

831

Avatar

Arun_Patidar

MVP

Total Posts

2.9K

Likes

1.0K

Correct Answer

831
Arun_Patidar
MVP

18-04-2019

Hi,

You can reuse the content in the following way in AEM:

  • By Reference
  • By inheritance
  • Content Fragments and Experience Fragments.
  • own implementation - for example, you can author list component in a page say list-container-page and author list. In your list component sightly code you write a logic to pick content from this authored list from list-container-page. if this page is not available or node is noted available then it picks content from the authored list in the current page.
    There could be other approaches based on your use case and architecture.

Avatar

Avatar

karanmahi

Avatar

karanmahi

karanmahi

18-04-2019

Hi Arun - I don't want to use the experience fragment. Is there any other way?

Avatar

Avatar

Arun_Patidar

MVP

Total Posts

2.9K

Likes

1.0K

Correct Answer

831

Avatar

Arun_Patidar

MVP

Total Posts

2.9K

Likes

1.0K

Correct Answer

831
Arun_Patidar
MVP

18-04-2019

yes, you can convert that component(s) into experience fragment and reuse the content.

Adobe Experience Manager Help | Using AEM Experience Fragments

Experience Fragments