When using metatags with content translation, the configured default meta tags for nodes are not displayed when adding a new node translation.

Steps to reproduce:
On a site with content translation enabled, and multiple languages active, with a standard/default installation of metatag:

  • Add a node in the site default language. Observe the default metatag title and description are displayed in the form.
  • Click 'add translation', which takes you to the node edit form.

Expected result:
The meta title and meta description fields should be pre-filled with the default values for nodes ("[node:title] | [site:name]" and "[node:summary]", respectively)

Actual result:
The meta title field incorrectly defaults to the global meta title of "[current-page:title] | [site:name]" (instead of the content/node default title) and the meta description is empty.

Note that if you translate the node title and the node body, and do not edit the meta tag fields, the correct meta tag values are output when viewing the node. The correct values are also displayed when you subsequently edit the translation. It just seems to display the wrong defaults when initially adding the translation.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

nicrodgers created an issue. See original summary.

nicrodgers’s picture

Assigned: nicrodgers » Unassigned
Status: Active » Needs work
FileSize
2.07 KB

Uploading a test-only patch that demonstrates the issue.

nicrodgers’s picture

Status: Needs work » Needs review

Setting to NR to trigger testbot. Test should fail.

nicrodgers’s picture

Assigned: Unassigned » nicrodgers
nicrodgers’s picture

The last submitted patch, 2: 2858057-metatag-default_value_translations-test_only-02.patch, failed testing.

nicrodgers’s picture

nicrodgers’s picture

DamienMcKenna’s picture

Status: Needs review » Fixed
Parent issue: » #2563615: Plan for Metatag 8.x-1.1 release

Thanks for putting that all together, and especially for the tests. Committed.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

jiisuominen’s picture

Hey!

I updated metatag to 1.x-dev and this was already applied. But I'm still getting the default meta tags on translated nodes.

I have modified the defaults to come from certain fields, but now the fields are always as they were.

Have I missed something or should this work by just updating to 1.x-dev?

I'm debugging this as we speak, but I may have to resort to hook_form_alter for now to get fields properly populated.