Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

SOLVED

inheritedPageProperties not available at all child levels

volgadr10
Level 2
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
KiranVedantam1992
Correct answer by
Community Advisor
Community Advisor

Hi @volgadr10,

 

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
KiranVedantam1992
Correct answer by
Community Advisor
Community Advisor

Hi @volgadr10,

 

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

volgadr10
Level 2
Level 2
Hi @KiranVedantam1992, 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.
KiranVedantam1992
Community Advisor
Community Advisor
Hi, please check if the pages are replicated/published properly is you are seeing the issue only in publisher