I'm having trouble configuring Metatag for Open Graph and Twitter Card images.
I'm using Drupal 8.9 core Media Image reference field as the source.
[node:field_hero_image] (Entity reference field) just returns the bare filename.
[node:field_hero_image:entity] (The referenced entity) also returns the bare filename, not the expected path to the image.
[node:field_hero_image:target_id] Just returns an integer. (In this case, it is 1.)
I'm reduced to trying to build the path by combining Tokens and plain text, like this:
This works, but the problem is that I used the default File Directory path:
That means media assets that I upload in February will be at a different path than the ones I uploaded last month, so hard-coding the path to the directory is pointless.
Now, I could change the File Directory path to a string literal like
images, delete all my Media Images and recreate them.
I'm guessing there is a better approach: either a Token that returns the correct image URL, or a way to bulk reconfigure Media Image assets after moving their File Directory.