Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

inheritedPageProperties not available at all child levels

Avatar

Level 2

I am facing an issue where my custom added property is available to direct children but not grandchildren. For example, I have a property showTitle and its value is set on page 1 and is available on page1.1 but not available on page 1.1.1. I need it to be available in all subpages of the page1. Any ideas on how to achieve that.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @Volga_Dharam_Rakshika,

 

You can access inheritedPageProperties in different ways:

  1. Sightly: ${inheritedPageProperties.myCustomProperty}
  2. Java: InheritanceValueMap 
    1. Definition as per the documentation: The InheritanceValueMap is an extension of the ValueMap which allows taking the hierarchy of resources into account while looking for properties. As such, if a property is not found on the current resource, it will be looked upon by its parent and so on. The exact inheritance mechanism depends on the implementation.
    2. Sample Code:
      1. @ScriptVariable
        private Page currentPage;
        InheritanceValueMap ivm = new HierarchyNodeInheritanceValueMap(currentPage.getContentResource());
        String inheritedValueMyCustomProperty = ivm.getInherited("myCustomerProperty"String.class);
  3. If it is JSP you can use the same way as Java.

 

Hope this helps.

 

Thanks,

Kiran Vedantam.

View solution in original post

3 Replies

Avatar

Correct answer by
Community Advisor

Hi @Volga_Dharam_Rakshika,

 

You can access inheritedPageProperties in different ways:

  1. Sightly: ${inheritedPageProperties.myCustomProperty}
  2. Java: InheritanceValueMap 
    1. Definition as per the documentation: The InheritanceValueMap is an extension of the ValueMap which allows taking the hierarchy of resources into account while looking for properties. As such, if a property is not found on the current resource, it will be looked upon by its parent and so on. The exact inheritance mechanism depends on the implementation.
    2. Sample Code:
      1. @ScriptVariable
        private Page currentPage;
        InheritanceValueMap ivm = new HierarchyNodeInheritanceValueMap(currentPage.getContentResource());
        String inheritedValueMyCustomProperty = ivm.getInherited("myCustomerProperty"String.class);
  3. If it is JSP you can use the same way as Java.

 

Hope this helps.

 

Thanks,

Kiran Vedantam.

Hi @Kiran_Vedantam, this works fine on author instance but on publish instance InheritedValueMap is not working as expected. It fetches the value from parent only not grandparent.

Avatar

Community Advisor
Hi, please check if the pages are replicated/published properly is you are seeing the issue only in publisher