How to inherit custom page properties on child pages? | Community
Skip to main content
kaikubad
Community Advisor
Community Advisor
November 1, 2022
Solved

How to inherit custom page properties on child pages?

  • November 1, 2022
  • 3 replies
  • 2317 views

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?
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 arunpatidar

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-osgi-bundle 

3 replies

Siva_Sogalapalli
Community Advisor
Community Advisor
November 1, 2022

@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.

 

kaikubad
Community Advisor
kaikubadCommunity AdvisorAuthor
Community Advisor
November 1, 2022

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

Siva_Sogalapalli
Community Advisor
Community Advisor
November 1, 2022

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. 

arunpatidar
Community Advisor
arunpatidarCommunity AdvisorAccepted solution
Community Advisor
November 1, 2022

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-osgi-bundle 

Arun Patidar
Jagadeesh_Prakash
Community Advisor
Community Advisor
November 1, 2022

@kaikubad  try below solution if this works

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