Closed (fixed)
Project:
Metatag
Version:
8.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
21 Dec 2020 at 23:06 UTC
Updated:
6 Dec 2021 at 15:54 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
bwaindwain commentedComment #3
bwaindwain commentedThis bug seems to only affect title and description.
If I type "abc" in the abstract field and then put
[node:field_metatags:abstract]in keywords, the keywords meta is "abc".Comment #4
mortim07 commentedI can't reproduce this on the dev branch or 1.15.
Comment #5
damienmckennaI wonder if it's a problem specific to the page title, because there is additional logic tied to how it works?
Comment #6
bwaindwain commentedIf I set Opengraph title to
[node:field_metatags:value]then I get<meta property="og:title" content="a:2:{s:5:"title";s:4:"asdf";s:8:"og_title";s:27:"[node:field_metatags:value]";}">which shows that "asdf" (the desired value) is in there somewhere (?!)
Comment #7
bwaindwain commentedIt seems to have something to do with the metatag defaults. If I clear the Global and Content defaults, then the
[current-page:metatag:title]token works as expected.But, of course, then new nodes don't get the default tokens.
Comment #8
eugene bocharov commentedIt seems like it isn't specific to the title. I have same problem for [current-page:metatag:description] and [term:field_metatags:description]
I look at this code
May be we should swap
metatag_get_default_tags($entity)with$metatag_manager->tagsFromEntity($entity)block? Because default metatags take precedence over entity's ones now. So if default tag is presented, token get it instead of enity specific.Comment #9
eugene bocharov commentedI added the tests to the previous patch. I haven't much exerience with writing tests yet, so if some more experienced person could take a look at this, it would be great.
Comment #11
eugene bocharov commentedOh, indentation problem, sorry. Fixed
Comment #12
njim commentedUpdated the steps to reproduce to be useful from a fresh Drupal install.
Comment #13
njim commentedComment #14
njim commentedThe patch applied correctly and I can confirm that the issue is resolved. Setting a value in the '' tag will trickle down as a token when used in an open-graph title metatag. I tested via Tugboat and updated the test steps within this ticket description.
This change makes sense to me. I would expect overrides to metatags to cascade through the 'general' section into more particular sections like open-graph metatags. But this change should be appropriately documented to inform users of possible regressions which they may not expect.
Code looks good and follows Drupal standards.
Comment #15
damienmckennaGood work, thank you!