- Issue created by @droprocker
- 🇮🇳India ajinkya45 Pune
You are right, I tried the same and I faced the same issue. This behavior due to a limitation in how Drupal's Token system which the Metatag module relies on handles multi-value entity reference fields, especially when those fields reference Media entities that in turn reference File entities (such as images). The token system does not fully support indexed access (:0:) for multi-value fields. Additionally, when dealing with nested entity references, for example: Node → Media field → Media entity → Image field → File entity → URL
the token resolution tends to fail silently. This is because the token system cannot reliably traverse these complex relationships in a deeply nested, multi-value context. In contrast, simple tokens like [node:field_image:entity:url] work as expected because they involve a single-level, single-value reference, which the token engine can easily resolve.To achieve the desired behavior what might work is:
1. Creating a custom token using hook_token_info() and hook_tokens().
2. Or, implement a custom preprocess hook in the theme or a custom module to programmatically set the Metatag values, allowing full control over multiple image meta tags.