Metatag Content title and description tokens when not defaults are not inherited

Created on 22 August 2024, 5 months ago
Updated 23 August 2024, 5 months ago

Problem/Motivation

There is an issue with token inheritance in multilingual content when using the Metatag module. Specifically:

Default tokens (e.g. [node:title], [node:summary]) are set for ie. title and description fields during module installation for the default node (Content) metatag type.
These default tokens are not properly inherited by content type metatags in certain scenarios:

  • On translated nodes
  • In some cases, even on nodes in the source language

The issue manifests as the metatag fields reverting to the default tokens instead of using the expected, content-specific values.
Currently, the only workaround is to explicitly set the token or value (not defaults) for title and description in the Content type metatag settings.

Steps to reproduce

By default, Drupal installs with [node:title] and [node:summary] tokens set for the default node (Content) metatag type.
When you replace these with a custom token (e.g., [node:custom:description] for the description), the custom token may not always be inherited by your node type (Content) metatag type. Instead, it may default back to [node:summary].
This issue is particularly noticeable on translated nodes.
If you manually set [node:custom:description] on the node type (Content) metatag type, it does work. However, this is not the desired behavior, as it bypasses proper inheritance.

The core problem is that token inheritance is not functioning correctly in this scenario, especially for translated content.

πŸ› Bug report
Status

Active

Version

2.0

Component

Code

Created by

πŸ‡§πŸ‡ͺBelgium johanvdr

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024