How to reuse component on another page? | Community
Skip to main content
AppHaus
Level 2
September 20, 2017

How to reuse component on another page?

  • September 20, 2017
  • 5 replies
  • 5334 views

Hello

I have a component filled with the same data and would like to use it on other pages in the website.  How can this be done?  Rather than recreate this component over and over again 100 times and adding the same data 100 times. 

I tried copy but will not paste on another web page.

Thank you for your help!

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

5 replies

smacdonald2008
Level 10
September 20, 2017

Typically a component on a page has its own data that is separate from other instances of the same component on other pages. For example, if you have an image component - although its the same image component (same sling resource type) - each instance shows a  different image.

AppHaus
AppHausAuthor
Level 2
September 22, 2017

Then does Adobe have a query component to access a database or xml file?

smacdonald2008
Level 10
September 22, 2017

Adobe Provides the APIs to let you write your own component to access a database. For example, to access MySQL, you use a DataSourcePool and configure it. Then you can use it to query data from MySQL and display the data in a page. We have a developer artilce that shows you how to use the DataSourcePool API:

Scott's Digital Community: Injecting a DataSourcePool Service into an Adobe Experience Manager OSGi bundle

YOu can watch a video too.

kautuk_sahni
Community Manager
Community Manager
September 21, 2017
joerghoh
Adobe Employee
Adobe Employee
September 23, 2017

If you want to do content-reuse within a page, this should be carefully planned. There are a lot of different ways how you can achieve this, but each one has pro's and con's, and without knowing much more details about your usecase it doesn't make sense to go into details.

To name some ways to reuse content, let me list some from the top of my head:

  • iparsys
  • reference component
  • multisite manager (MSM)

The decision which one to use is driven by the (content) architecture of your application/site. From my point of view it should never be the decision of a developer which approach to use!

Jörg

AppHaus
AppHausAuthor
Level 2
September 27, 2017

I did not mark Jorg Hoh as the correct answer. 

The decision can be from a developer or designer!

joerghoh
Adobe Employee
Adobe Employee
September 28, 2017

Hi,

Of course a designer or a developer can make that decision, but in most cases a designer or a developer does not see all the consequences coming from that decision.

For example, are you aware of the consequences of using the MSM to achieve content reuse? It has impact on the authoring process as a whole, because authors now suddenly need to break inheritance to change a page. And enable inheritance to get the latest changes. If you use a kind of freestyle-MSM (neither planned nor managed usage of it) your authoring process will be unmanaged too, because noone understands easily what impact a rollout might have.

Then about the different rollout options, which will have a huge impact too. Not to talk about the resulting system load.

Same with iparsys or reference component.

Content reuse is an essential part of the information architecture and your business domain. I think that any decision and change here should made with care.

smacdonald2008
Level 10
September 28, 2017

We marked Joerg's answer as correct as he provided an excellent response that addresses this question.

AppHaus
AppHausAuthor
Level 2
September 27, 2017

So if you have a component like a -dropped down selector- listing all of the United States- for the user to choose from… you are basically stating here that it can't be done other than what I suggest is to created db or xml file.

Just wanted to be sure we are all on the same page here with my question.

Thanks again for your feedback!

AppHaus
AppHausAuthor
Level 2
September 28, 2017

If anyone can contribute or help with an example to my question or point me to a third party tool that would be great!

Right now, the requests I'm getting are totally not realistic because people making the decisions are not certified or have the technical background to know any better.

Thanks to all who have given there time to this question.

smacdonald2008
Level 10
September 28, 2017

Its unfortunate that you consider Joerg answer as not correct as he is one of the top AEM ppl within this community. He mentioned MSM and Kautuk mentioned Content Fragments - both of which are meant to help with re-use of content.

Of course you can go back to basics and have authors drag and drop and components onto the parsys and edit the components - which is typically the job of an AEM author and the way AEM works at the basic level.