Retrieve any custom property from page using HTL | Adobe Higher Education
Skip to main content
Level 6
August 6, 2021
Besvarat

Retrieve any custom property from page using HTL

  • August 6, 2021
  • 3 svar
  • 1610 visningar

Hello community - is there a way to retrieve any page property other than the component node. i.e I have a component, in that I want to retrieve page's custom property which is not part of component node. I tried the below but it is not working. Can you advise me?

 

${page.getProperties['root/responsivegrid/content/customPropertyName']}

Bästa svar av BimmiSo

Hi @test1234567 ,

 

Please use 

${pageProperties.propertyName @ context='html'}

 

And for any parent level property 

${inheritedPageProperties.propertyName}

 

And if you want to fetch component's property from page(components html) then make use of model of that component in page. There is no direct way to fetch those

 

If you need those properties in same component's html then simply use ${properties.propertyName}

 

Hope this helps!!!

 

Thanks

3 svar

Umesh_Thakur
Community Advisor
Community Advisor
August 6, 2021

Simply use ${pageProperties.name_of_the_property@ context='html'} or ${pageProperties.name_of_the_property}

for example to get title of the page use ${pageProperties.jcr:title @ context='html'} or ${pageProperties.jcr:title}

 

this is to get only currrent page properties if you need parent page properties you can use inheritedPageProperties to get the same.

 

Hope this will help.

Umesh Thakur

Adobe Employee
August 6, 2021

Hi @test1234567 ,

 

Please use 

${pageProperties.propertyName @ context='html'}

 

And for any parent level property 

${inheritedPageProperties.propertyName}

 

And if you want to fetch component's property from page(components html) then make use of model of that component in page. There is no direct way to fetch those

 

If you need those properties in same component's html then simply use ${properties.propertyName}

 

Hope this helps!!!

 

Thanks

Umesh_Thakur
Community Advisor
Community Advisor
August 6, 2021
Adalbero
New Member
February 26, 2025
Add this method to your model class then you can use:
 
${<model>.childProperties.<child-node>.<property>}
 

 

/** * Get the properties of child nodes. * * return ValueMap of the child nodes. */ @9944223 public ValueMap getChildProperties() { Resource resource = request.getResource(); Map<String, Object> map = new HashMap<>(); resource.getChildren().forEach(child -> { map.put(child.getName(), child.getValueMap()); }); return new ValueMapDecorator(map); }