Despite alt being shown as an available token, attempting to use it to populate the Twitter Card Alternative Text metatag results in an error.
Steps:
1. Enable a field in content types named Image
2. Enable alternate text for the image
3. Install and enable the Metatag and Metatag: Twitter Cards modules
4. Go to /admin/config/search/metatags/config/node
5. Enter the following in Twitter Card Image URL field: [node:field_image]
6. Enter the following in Twitter Card Image alternative text: [node:field_image:alt]
7. Click Save button
Expected results: Configuration is saved
Actual results: Twitter Card Image alternative text is outlined in red. Error message:
The Image alternative text is using the following invalid tokens: [node:field_image:alt].
Note: If, in the Twitter Card section, I click Browse available tokens, I get the following information under Image:
Field "field_image". The following properties may be appended to the token: file (The image file.), alt (The "Alt" attribute text)
Comment | File | Size | Author |
---|
Comments
Comment #2
DamienMcKennaThat token isn't available out of the box with Drupal core or the Token module:
If you install Imagecache Token you'll get extra tokens for each image field:
Is that what you were looking for?
Comment #3
Charles BelovNope, it was my bad, sorry.
It appears the tokens are inconsistent as to whether they require underscores or hyphens between words.
Image [node:field-director:field_image] Image field. Also known as Large Image (770 pixels wide).
Image [node:field-director:field-image:?] Field "field_image". The following properties may be appended to the token: file (The image file.), alt (The "Alt" attribute text)
If I use [node:field-director:field-image:alt], it works. That is, the program saves my configuration and displays the correct metatag and contents in the content page output.
That's what I get for not copying and pasting.
Changing category to support and closing.
Comment #4
DamienMcKennaAh! That means you have the Entity Token module installed. There's a long-standing conflict between that module and the Token module, see #1272560: Entity tokens duplicates field tokens created by token module for more. Sorry about that.
Comment #5
Charles BelovThank you for the detective work. Confirmed and now following that issue.
Comment #6
Charles BelovAnd actually, I'm guessing that explains why sometimes I get the tokens as insertion links and sometimes I don't. That if Token is ruling, I get the links and if Entity Token is ruling I don't get the links and have to copy and paste. This is only a guess.