Token for Image in Schema.org ImageObject

Created on 22 January 2018, over 7 years ago
Updated 30 July 2025, 16 days ago

Hi,

Just wondering about he ImageObject field in the schema_metatag module.

The fields for images for Twitter Cards and Open Graph allow us to use a token such as
[node:field_main_image:entity:field_m_image_image]
And the help text says "Note: Tokens [...] will be able to extract the URL from an image field."

However, this module asks for an absolute URL. We are probably not going to know this in advance (especially for user generated content) so it would mean editing every node once published to copy in the URL to the main image.

Would it be possible to have token support added for this?

📌 Task
Status

Fixed

Component

Documentation

Created by

🇮🇪Ireland markconroy

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇨🇳China guaneagler

    This works as said in #5:
    [node:field_main_image:entity:field_m_image_image:default:url]

    FYI, the "default" is the image style machine name.

    If I want to use the original image url here, I can add a image style named "default" and make it output original image. Do I have any other special name to output original image url without using new image style?

  • 🇮🇪Ireland markconroy

    Hi @guaneagler,

    You can try something like this in your token to see if you get the URL of the original image.
    [node.field_main_image.entity.field_media_image.entity.uri.value]

Production build 0.71.5 2024