Expand my Community achievements bar.

SOLVED

How to inherit custom page properties on child pages?

Avatar

Community Advisor

I have three template. All page are inherited from a root named page

  1. Homepage template
  2. Content page template
  3. Search page template

And Content structure is

  • home-page-template
    • content-page-template-1
      • content-page-template-1.1
      • content-page-template-1.2
        • content-page-template-1.2.1
      • ....
    • search-page-template
      • .....
    • ........

I have added a custom tab on page dialog with two path browser. I want to configure it on home-age template and needs to inherit it on all child level templates pages.

 

  • home-page-properties
    • custom-prop-1 = abc
  • this property needs to be inherited on all child level different pages. How to achieve this?
1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi,

You can use inheritedPageProperties  global object in slightly/java to read page properties from parent pages.

Please check below article from @BrianKasingli 

https://sourcedcode.com/blog/aem/aem-quick-reference/aem-inheritedpageproperties-with-sightly-jsp-os... 



Arun Patidar

View solution in original post

5 Replies

Avatar

Community Advisor

@kaikubad what is the purpose of the custom property you're using in page properties?

Are you going to do something on the page level by using the property? 

please share more details.

 

Avatar

Community Advisor

Sorry can not share the bussiness logic here. But thats the requirement i wrote. Please help if you know how to achieve the requirement

Avatar

Community Advisor

no issues, i don't want you share the business logic here  

As i understood, i don't think there is an OOTB solution for this, you need to look for custom solutions. 

Avatar

Correct answer by
Community Advisor

Hi,

You can use inheritedPageProperties  global object in slightly/java to read page properties from parent pages.

Please check below article from @BrianKasingli 

https://sourcedcode.com/blog/aem/aem-quick-reference/aem-inheritedpageproperties-with-sightly-jsp-os... 



Arun Patidar

Avatar

Community Advisor

@kaikubad  try below solution if this works

@Inject
private InheritanceValueMap pageProperties;
 pageProperties.getInherited("propName", StringUtils.EMPTY)