Page Manager Metatags Added Twice

Created on 14 June 2024, 7 months ago

The metatags for a page manager page variant appear to be added to a page twice, once from metatag_page_manager_metatags_alter() and then again in metatag_page_manager_page_attachments().

An additional issue with this, and what caused me to discover it, is that this means you can't override any metatags by implementing hook_metatags_alter() or hook_metatags_attachments_alter() in your own module. This is because the call to metatag_page_manager_page_attachments() is happening after those hooks are triggered in the main metatag module, and then not triggered again. Currently, if you wanted to override the metatags of a page manager variant, you'd have to implement hook_page_attachments() and then override things there, defeating the purpose of the metatag module hooks.

I believe the solution here is just to remove metatag_page_manager_page_attachments(). Reviewing the metatag_views module, it only has an implementation of hook_metatags_alter() to add its metatags. I've bypassed metatag_page_manager_page_attachments() in my custom module via hook_module_implements_alter() and everything is now working as expected.

πŸ› Bug report
Status

Active

Version

2.0

Component

Integration with other module

Created by

πŸ‡¨πŸ‡¦Canada johnjw59@gmail.com

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

Comments & Activities

Production build 0.71.5 2024