Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
In html.html.twig, drupal does the following
<title>{{ head_title|safe_join(' | ') }}</title>
But the thing is that metatag only alters head_title.title and let the core's head_title.name and head_title.slogan values so the site name is always appended to the meta title even when no [site:name] token is used.
Steps to reproduce :
- Install drupal
- Enable metatag
- Add the metatag field on your content type
- Use [node:title] | [site:name] as default value as adviced by the help text
- Create a node
Expected result : [node:title] | [site:name]
Current result : [node:title] | [site:name] | [site:name]
Proposed resolution
Clear the head_title array before adding the title.
Remaining tasks
Patch, review, commit.
User interface changes
None.
API changes
None.
Data model changes
None.
Comment | File | Size | Author |
---|---|---|---|
#2 | metatag-title_site_name-2603548-2.patch | 750 bytes | DuaelFr |
|
Comments
Comment #2
DuaelFrComment #3
DamienMcKennaSounds like a quick fix.
Comment #4
DamienMcKennaCommitted. Thanks!