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 :

  1. Install drupal
  2. Enable metatag
  3. Add the metatag field on your content type
  4. Use [node:title] | [site:name] as default value as adviced by the help text
  5. 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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

DuaelFr created an issue. See original summary.

DuaelFr’s picture

Status: Active » Needs review
FileSize
750 bytes
DamienMcKenna’s picture

Sounds like a quick fix.

DamienMcKenna’s picture

Status: Needs review » Fixed

Committed. Thanks!

  • DamienMcKenna committed 3b06abb on 8.x-1.x authored by DuaelFr
    Issue #2603548 by DuaelFr: Clear our the head_title array to avoid the...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.