Problem/Motivation
Meta tag overwrites work as specified at /admin/config/search/metatag. "Meta tag patterns are passed down from one level to the next unless they are overridden."
At the "Global" level the title tag is specified as [current-page:title] | [site:name]. For the "Content" level the title tag should be created from a field that was specifically created for creating a meta title, the token of which is [node:field_meta_title]. So title tag on the "Content" level is defined as [node:field_meta_title] | [site:name] as can be seen in screenshot [0].
So my guess is that if I create a new page with the default content type "Basic page" the meta title should be created from [node:field_meta_title] but this is not the case. The meta title is still created from the "Global" level title tag definition [current-page:title] as shown in [1].
[0]: https://screenshot.sunlime.at/e24a98f810cad38d7002468c0d04163c
[1]: https://screenshot.sunlime.at/dec4efd30dd6b4c76d4d7b43d8d93912
Maybe I am missing something but in this case overwriting the "Global" level is not working.
Comments
Comment #2
criscomComment #3
damienmckennaDangit :-\
Comment #4
jasonschweb commentedWe are also seeing this behavior; trying to update meta tags for specific content types and product entities and it seems to be overwritten by global meta tags.
Comment #5
uridrupal commentedProbably this issue is already solved, but just in case I was able to make it work adding :value to the metatag field.
Example: [node:field_share_description:value] instead of [node:field_share_description]
If you ask my why this works, I have no idea, I'm sorry.
Comment #6
idebr commentedI had this occur in a website configured in 2016. It turned out the default values were not correctly overridden because the global setting was set as a default value in the field instance setting (field.field.node.page.field_metatags.yml):
Before:
Fixed:
Comment #7
sic commentedhaving this issue also in d7
Comment #8
chris dart commentedThe problem appears to be after a newly created node is saved.
Here's my scenario:
The metatag values for my news content type has a different og:image and twitter_cards_image value from what is defined for the global metatag configuration.
When I create a news item, the metatag values that show up in the sidebar are correct--they're from the news content type's metatag settings.
But when I save the node, the page html shows the global settings. And when I edit the newly created node, the metatag settings have been changed to the global values.
So my guess is that on save, the metatag module is ignoring the news values that are in the metatag form on the news page, and defaulting to the global values.
Comment #9
yusufhm@idebr's fix worked for me; I had two content types that had that default value and the metatag was overwritten for them; new content types that I recently created did not have the default value set, so I got rid of the default for the first 2, and that fixed the issue.
Note that this will only apply to new nodes upon creation; existing nodes with the wrong metatag value will need to be updated manually.
Comment #10
handkerchiefWow, after 6/7years no progress here, because it's still the same issue on Drupal 11.
Workaround:
1. Add custom textfield to content types: "field_page_title"
2. Fill in some custom page titles to the nodes
3. Add a hook_preprocess and set the page title if field is not empty