Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

Retrieve thumbnail URL from page properties in AEM 6.4 using sightly

Avatar

Level 1

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" />
Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Level 1

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.

View solution in original post

9 Replies

Avatar

Community Advisor

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.

Avatar

Level 1
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.

Avatar

Community Advisor

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.

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.

Avatar

Community Advisor

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

Avatar

Correct answer by
Level 1

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.

Avatar

Level 1

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

Avatar

Level 1

Did you resolve this issue? Since, I'm facing the same issue