Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hello, i have a content with no image fields, but i embed images and other media in the body field using a WYSIWYG editor.
Is there a way to set one of the images (for example the first one) embedded in the body as the og:image?
There is not a such token in the list.
Thanks.
Comments
Comment #1
DamienMcKennaThere aren't tokens for this because it's such a awkward thing to do. You'd have to search through the text fields in the entity (node, user, term, etc) looking for image tags, custom embed codes for different modules (Media, entity embed, etc).. it might be better to build a widget that could grab the URL of any photo elsewhere on the page.
Comment #2
DamienMcKennaComment #3
haunted CreditAttribution: haunted commentedOk, I got it, thanks for your attention.
Comment #4
robertom CreditAttribution: robertom commentedHi, sorry for my bad english.
I need this feature and I created a sandbox for this (Token inline images).
The module is not properly tested, but it seems to do what I need
I'm a newbie with token and entity code... so very willingly accept bug reports and suggestions.
Comment #5
haunted CreditAttribution: haunted commentedGreat! I'll test it as soon as possible. Thank you very much.
Comment #6
EurekaWeb CreditAttribution: EurekaWeb commented@DamienMcKenna
per discussion in Add token to scrape the node body field for an image https://www.drupal.org/project/metatag/issues/2763745
has there been any further testing on the sandbox written by @robertom?
Thanks