Retrieve thumbnail URL from page properties in AEM 6.4 using sightly | Community
Skip to main content
August 29, 2020
Solved

Retrieve thumbnail URL from page properties in AEM 6.4 using sightly

  • August 29, 2020
  • 5 replies
  • 8117 views

Is it possible to insert thumbnail image URL from page properties of Thumbnail tab into og:image inside meta tag. I am able to get values of pageTitle and description properties but not the image. Or is there a better way to handle this?

<meta property="og:url" content="${head.pagePath}" />
<meta property="og:title" content="${properties.pageTitle}" />
<meta property="og:description" content="${properties['jcr:description']}" />
<meta property="og:image" content="imageURL" />
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by

Thank you all for your replies. I studied Social Sharing core component source code for a bit and ended up re-using getThumbnail() method to get page thumbnail reference and that worked out as expected.

5 replies

Varun_Shakya
Community Advisor
Community Advisor
August 29, 2020

if the thumbnail image is coming from DAM ,then the page have "image" node in jcr:content of page and that image node will be having fileReference property which will have your image path of thumbnail. In this case you can make use of resource object and get the child node image and then get the property(fileReference).

 

If the thumbnail has been uploaded from file system in template. In that case it will not be easy to get.i would say take thumbnail from DAM.

August 30, 2020
Yes, seems like it's coming from DAM content_node-->jcr:content-->image-->file-->dam:thumbnails-->dam:thumbnail_300.png. However, I am not able to find fileReference property anywhere under the image node or under any node.
Nikhil-Kumar
Community Advisor
Community Advisor
August 29, 2020

@17381786 


Try reading it through node props.

 

Singaiah_Chintalapudi
Level 7
August 30, 2020

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 the image ref path. You'll have to use Server Side script (JavaScript API) or use Java to read this and inject back to HTL/HTML.

August 30, 2020
Path /content/yourpagepath/jcr:content/image/file/jcr:content/dam:thumbnails/dam:thumbnail_300.png does exist but cannot find fileReference property under any of these nodes.
arunpatidar
Community Advisor
Community Advisor
August 31, 2020

Thumbnail are generated either from template(DAM or browsed image) or uploading direct on page. If you have thumbnail reference from DAM then you can see a property in page otherwise you need to read from local but you can't use that in og tags.

 

 

Arun Patidar
Accepted solution
September 1, 2020

Thank you all for your replies. I studied Social Sharing core component source code for a bit and ended up re-using getThumbnail() method to get page thumbnail reference and that worked out as expected.

February 25, 2022

Hey @17381786 Could you please help with this? I have the same issue 😞