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.
Hey Drupalistas
I am using metatag-8.x-1.x-dev and I found out that metatags are not using the translated fields.
How to reproduce:
- Multilingual Drupal setup.
- Create node, translate node.
Use default metatag settings.
I have included 2 screenshots:
1) NL node, with NL summary. (normal behaviour)
2) FR node, with NL summary. (wrong behaviour)
Comment | File | Size | Author |
---|---|---|---|
#16 | default_metatags_are-2658242-16.patch | 7.35 KB | mr.baileys |
#16 | default_metatags_are-2658242-16-test-only.patch | 5.01 KB | mr.baileys |
#8 | default_metatags_are-2658242-8.patch | 7.42 KB | mr.baileys |
#8 | default_metatags_are-2658242-8-test-only.patch | 5.08 KB | mr.baileys |
#5 | default_metatags_are-2658242-5.patch | 2.34 KB | mr.baileys |
Comments
Comment #2
DamienMcKennaDid you set the Metatag field to be translated?
Comment #3
yvesvanlaer CreditAttribution: yvesvanlaer at Mia Interactive commentedI have everything enabled when it comes to translations:
- Configuration Translation
- Content Translation
- Interface Translation
- Language
When it comes to Metatag, I already tried using the "translate" button in the metatag config overview.
The metatag needs to get the translated body field :-).
Right now I'm using:
description: [node:summary]
og_description: [node:summary]
Comment #4
1mundus CreditAttribution: 1mundus commentedI have the same problem with front page metatags. I'm using two languages and only the default language is recognized. When I switch to non-default language, it doesn't use the translation, but the default language is used instead.
My meta tags are manually inserted strings, there are no tokens involved.
Drupal version: 8.0.3
Metatags version: beta4
Comment #5
mr.baileysTokens are replaced language-unaware, attached patch should fix the issue by passing the active language to the token replacement logic. Still needs tests though.
Comment #6
DamienMcKennaNice! I'll review it soon.
Comment #7
DamienMcKennaStill needs tests ;)
Comment #8
mr.baileysNow with tests.
Comment #15
mr.baileysI thought the test failures might be related to the fact that the testbot tests with Drupal Core 8.1.x, but tests are running fine with 8.1.x on my local machine too, so not sure what is causing it to fail on the testbot.
Comment #16
mr.baileysSo... test were failing since I committed requests to my local dev machine as part of the URL's used in the tests...
Comment #20
DamienMcKennaCommitted. Thanks again mr.baileys!