3

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" />
hitcher
  • 33
  • 6

1 Answers1

2

You can reference it as ${properties['image/fileReference']} if it is provided via DAM (so you can use web renditions this way). If the asset is attached to the page itself (uploaded directly) you can use Thumbnail servlet to reference rendered thumbnails using following convention: /content/[path-to-the-page].thumb.319.319.png

AEM creates 48x48, 140x100 and 319x319 thumbnails out of the box, since you are planning to use it for providing reference to reusable image via OpenGraph protocol you might need to customize thumbnails creation workflow to add higher resolution into the pipeline.

Jura Khrapunov
  • 1,024
  • 6
  • 14
  • Thank you for the detailed explanation. I studied Social Sharing core component source code and ended up re-using getThumbnail() method to get page thumbnail reference that worked out as expected. – hitcher Sep 01 '20 at 00:41