Problem/Motivation
CustomElementsMetatagsGenerator::getMetatags() only looks at the node route parameter. For any other content entity route, e.g. taxonomy terms, Canvas pages or other entity types with Metatag defaults, the custom elements response carries empty metatags. The HTML output of the same route does have title, description, canonical link and Open Graph tags, because Metatag supports every content entity type. A decoupled frontend therefore loses all metatags on non-node pages.
Steps to reproduce
- Enable Metatag and lupus_ce_renderer, with Metatag defaults for taxonomy terms (e.g. the global defaults).
- Create a taxonomy term.
- Request
/taxonomy/term/{id}?_format=custom_elements. - The response has
metatags.metawithout the term's title andmetatags.linkwithout a canonical link. The same request for a node returns both.
Proposed resolution
Fix and add tests
Remaining tasks
- Review.
User interface changes
None.
API changes
New protected method CustomElementsMetatagsGenerator::getRouteEntity().
AI disclosure
This issue and the patch were drafted with AI assistance (Claude Code). A maintainer reviewed and tested the change before posting.
Issue fork lupus_ce_renderer-3629041
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
fagoI figured this was missing and we had patched this internally for a while to support canvas. Time to fix that upstream. Created MR!
Comment #5
fagothis works reliably, code is good and tested, merged.