- Issue created by @mvonfrie
_metatag_remove_duplicate_entity_tags(array &$build)
is used to remove rel="canonical"
and/or rel="shortlink"
link tags built by the entities itself if those are provided by metatag, to prevent duplicates. This still might work for taxonomy terms via metatag_page_attachments_alter()
executed as last page attachments alteration, but calling it from metatag_entity_view_alter()
doesn't work anymore since the links generated by Drupal\Core\Entity\Controller\EntityViewController::view()
are added just before the final rendering via bubblable metadata, which cannot be catched and removed by either of the hooks mentioned above.
Duplicated rel="canonical"
and/or rel="shortlink"
have a huge negative SEO impact on production sites, therefore setting the priority to major.
I don't know if this can be fixed without modifications to the core, so unfortunately I have no idea how to solve this. #2922570 → is a starting point to search where it comes from.
Active
2.1
Code