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
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

Use featured image from page properties in HTL

Avatar

Level 4

I want to render the current page featured image on the same page. And for that I am using HTL. Is there a way I can just call currentPage or properties object in HTL to get that image as we do for jcr:title( ${properties.jcr:title})?

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi,

The names of the property is at https://github.com/adobe/aem-core-wcm-components/blob/72ee9a869c51deb4e5d2a5c1ec5b60c5579b2f68/conte...

 

You must try

${pageProperties['cq:featuredimage/fileReference']}

 

 

View solution in original post

13 Replies

Avatar

Community Advisor

Hi @nikita24tailor 

It depends on your customization (Static/Editable templates). If you're not customizing anything then it would store here- /content/yourpagepath/jcr:content/image. If you look at the property of fileReference then you'll see the image reference path. You'll have to use Server Side script (JavaScript API) or use Java to read this and inject back to HTL/HTML.

Regards,
Santosh

Avatar

Level 4

I'm not using any custom property for image. I'm using the one which is already available in page properties in Image tab.

Avatar

Community Advisor

@nikita24tailor 

Do you mean this Thumbnail Image? It looks like that Image tab is customized one - If yes refer to my above answer please.

Screen Shot 2022-05-17 at 10.10.29 PM.png

Avatar

Level 4

No, not this thumbnail, there is other image tab in aem as a cloud service. And that is not the customized one.

Avatar

Level 10

Hi @nikita24tailor ,

You can read the image fileReference like this - 

${properties['image/fileReference']}

Avatar

Level 10

Can you share a screenshot of which image property you are checking and in which tab for page properties.

Avatar

Community Advisor

Can you share,

1. what is the property name ?

2. where are want to access this property? in a component or in a page component?

Avatar

Level 4

1. There is no property name. I just want to use the featured image of the core page component. It is found in the dialog box. here is the screenshot:Screenshot from 2022-05-18 17-48-52.png

 

2. I want to access this in HTL of a component.

Avatar

Correct answer by
Community Advisor

Hi,

The names of the property is at https://github.com/adobe/aem-core-wcm-components/blob/72ee9a869c51deb4e5d2a5c1ec5b60c5579b2f68/conte...

 

You must try

${pageProperties['cq:featuredimage/fileReference']}