Expand my Community achievements bar.

SOLVED

Retrieve any custom property from page using HTL

Avatar

Level 4

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']}

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

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

View solution in original post

3 Replies

Avatar

Community Advisor

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

Avatar

Correct answer by
Employee Advisor

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