Reusing components across sites | Community
Skip to main content
merajs48779722
Level 2
April 28, 2017
Solved

Reusing components across sites

  • April 28, 2017
  • 6 replies
  • 2687 views

This is regarding re using of components of Site A to Site B. We have a multi tenant architecture where different sites are to be developed sharing common AEM with different branch w.r.t. sites.

There are components which are project specific (having project specific client libs), and other common components (common client libs) which can be reused for other websites.

The question is that, once it is deployed in prod and after go live, if Content author wants to use components of other site, can he use it dynamically.

E.g. If Component C1, C2, C3 are developed for Site A, Component C5, C6, C7 are developed for Site B. Both are in production and content author wants to add C2 from site A to Site B. 

To do that, should it go by development phase by putting C2 libs in common lib and make it available for site B. Or is there any way Content Author can dynamically reuse Component C2 to Site B without making any technical configuration change. We are using AEM 6.1.

Quick help on this is appreciated.

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 MC_Stuff

Hi Mera JS,

   Short answer it deponds but technically possible.   It is possible to use C2 in Site B by using proxy approach Or modifying allowed filters Or using selectors.   Things become more complicated if component have dependency on site specific templates Or Permission checks.   If you think from long term perspective if component is idle suited for two sites means it should be under commons so that any other sites required can make use of it.    My experience based on different implementations,  strategy worked out was 

  • If teams of two sites have good collobaration I would keep in common area.   As demands will move from site specific to common area. This saves lot of reworks and team to review each other.
  • If teams of two sites do not have health collaboration I would keep in different sites. If required will copy component from one site to another by duplicating.  This has advantage of release cycle with no dependency Or additional testing of other site of any changes. 

Personally I am inclined towards moving into common area.

Thanks,

6 replies

MC_Stuff
MC_StuffAccepted solution
Level 10
April 29, 2017

Hi Mera JS,

   Short answer it deponds but technically possible.   It is possible to use C2 in Site B by using proxy approach Or modifying allowed filters Or using selectors.   Things become more complicated if component have dependency on site specific templates Or Permission checks.   If you think from long term perspective if component is idle suited for two sites means it should be under commons so that any other sites required can make use of it.    My experience based on different implementations,  strategy worked out was 

  • If teams of two sites have good collobaration I would keep in common area.   As demands will move from site specific to common area. This saves lot of reworks and team to review each other.
  • If teams of two sites do not have health collaboration I would keep in different sites. If required will copy component from one site to another by duplicating.  This has advantage of release cycle with no dependency Or additional testing of other site of any changes. 

Personally I am inclined towards moving into common area.

Thanks,

merajs48779722
Level 2
April 30, 2017

Thanks MC Stuff for your valuable input.

So in any case it can not be done directly by content author. Whenever team B's content author want to add C2 from site A to site B, component C2 needs to be added in common lib which will need some development involvement to make C2 available for site B. Please let me know if my understanding is correct (assuming both team has good collaboration).

Is there any good link for this case, so that I can have more detailed understanding.

Regards,

Meraj

smacdonald2008
Level 10
May 1, 2017

I would put the components in a common area so they can be used in S1 and S2. 

Ayoub_Tabai
May 17, 2024

Have you done this before? If so, could you please share the steps? I have a few questions in mind: How can a component be moved along with all its dependencies? Additionally, if I create a multi-module project, how can this project be referenced by other sites to reuse the components? Thanks in advance.

MC_Stuff
Level 10
May 2, 2017

Hi Meraj,

        To be precise it is not " component C2 needs to be added in common lib"  instead " component C2 needs to be moved into common lib". Yes your understanding is correct, it needs some development  and qa efforts.

     Regarding documentation it comes under designing reusable components. I do not think there is specific for AEM.

Thanks,

merajs48779722
Level 2
May 2, 2017
        Thanks for clarification. It helped to understand the scenario.
merajs48779722
Level 2
May 2, 2017

Thanks for clarification. It helped to understand the scenario