Can't find the right token (URL) for og:image in Drupal 10

Created on 11 September 2023, almost 2 years ago

Problem/Motivation

My setup is: Drupal 10.1.3 and Metatag 2.0.0

In all of my content types, I have the same image field:
Label: Image
Machine name: field_media_image
Field type: Entity reference
Reference type: Media
Media type: Image

I'm trying to add og:image metatag to my pages for all content types.

So I've enabled 'Metatag: Open Graph' submodule and proceeded to:
admin/config/search/metatag/node

In 'Open Graph' section I've tried these combinations (both with Image and Image URL):

[node:field_media_image]
The result is:
<meta property="og:image" content="https://site.commy_image.jpg">

[node:field_media_image:entity:url]
The result is:
<meta property="og:image" content="https://site.com/media/23/edit">

[node:field_media_image:entity:field_media_image:url]
The result is:
<meta property="og:image" content="">

Which token should I use to make it look:
<meta property="og:image" content="https://site.com/sites/default/files/2023_09/image_name.jpg">

πŸ’¬ Support request
Status

Active

Version

2.0

Component

Open Graph

Created by

πŸ‡¬πŸ‡ͺGeorgia almador

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024