Reference Components | Community
Skip to main content
Ankur_Khare
Community Advisor
Community Advisor
October 16, 2015
Solved

Reference Components

  • October 16, 2015
  • 4 replies
  • 1625 views

I have a set of components which needs to be changed once on one page and the changes should get reflected across multiple pages and the pages where these changes will be reflected will be using different templates.

How should i achieve this requirement.Please suggest some approach.

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 Runal_Trivedi

You can follow below steps to achieve it:

If you component can be dragged in container then:

  1. On your main page drag the component in parsys container and configure it with data
    • Or you can create a config admin only page with parsys container (contains only parsys in JSP Script)
  2. Once you have configured it then on rest of the pages you can use OOTB Reference component and link it to the content that you configured in step-1.
    • Any changes now you make on content on page of step-1 will automatically get propagated to other pages that has got its reference.

Find more on reference component here - http://docs.adobe.com/docs/en/cq/current/wcm/default_components/editmode.html#Reference.

If you component is embedded one then:

  • You can use inheritedValueMap concept to inherit configuration from Parent Pages
    • The only restriction with using InheritedValueMap is; it inherits configuration only from parent pages and also the relative path of component node under /jcr:content/ should remain same on all pages.
    • i.e. /content/site/parent/jcr:content/comp1, /content/site/parent/child1/jcr:content/comp1

See what suits you

Thanks

Runal

4 replies

vikramca06
Level 4
October 16, 2015

Hi,

Boilerplate Component may help you. Please refer http://docs.adobe.com/docs/en/cq/current/developing/boilerplates.html.

Just provide access to all the authors, so that any author can edit the boilerplate content.

Thanks.

Vikram

Runal_Trivedi
Runal_TrivediAccepted solution
Level 6
October 16, 2015

You can follow below steps to achieve it:

If you component can be dragged in container then:

  1. On your main page drag the component in parsys container and configure it with data
    • Or you can create a config admin only page with parsys container (contains only parsys in JSP Script)
  2. Once you have configured it then on rest of the pages you can use OOTB Reference component and link it to the content that you configured in step-1.
    • Any changes now you make on content on page of step-1 will automatically get propagated to other pages that has got its reference.

Find more on reference component here - http://docs.adobe.com/docs/en/cq/current/wcm/default_components/editmode.html#Reference.

If you component is embedded one then:

  • You can use inheritedValueMap concept to inherit configuration from Parent Pages
    • The only restriction with using InheritedValueMap is; it inherits configuration only from parent pages and also the relative path of component node under /jcr:content/ should remain same on all pages.
    • i.e. /content/site/parent/jcr:content/comp1, /content/site/parent/child1/jcr:content/comp1

See what suits you

Thanks

Runal

Level 6
October 16, 2015

If the changed component is in a template, then it is easy. Just change all the templates. But I have a feeling that it is not that easy.

Most likely, you have a component in a paragraph that needs to be converted. What you then need to do is to first sit down and figure out what you would have been forced to do if you have had to do it manually. Then draw that process so. That is the hard part. The easy part is then to write either a workflow process, a script or a triggable service that can execute all the steps.

Anything you can do manually in CRX/DE or the author environment, is also possible to do in code. This is what I call the transformer pattern.

/Ove

apurva_gilke
October 16, 2015

Hi,

Even I have the same requirement issue. For this I tried to create an admin page consisting of common components that are present across the site(header, footer, logo, tabs etc.). But any changes in the admin page are not getting reflected in other pages. Can you suggest ways to link other pages to the admin page or some other alternative for the requirement?