Special characters decode breaks page title

Created on 29 April 2025, 3 months ago

Problem/Motivation

The metatag module is modifying the page title when applying htmlentities_decode to the meta values.

See https://git.drupalcode.org/project/metatag/-/blob/2.0.x/src/MetatagManag...

Steps to reproduce

On a vanilla install of D10 with metatag module enabled, create a page with a less than symbol and some text with no space, ie "this is my Save the page and view
With metatag module enabled, the title is truncated from the less than (becomes "this is my")
Leave the node unchanged and disable the metatag module.
The title is now correct.

Proposed resolution

I'm not sure if we need metatag to modify the page title at all. Maybe it could be excluded from the loop processing the values.

Note that this code exists also in 2.1.x; https://git.drupalcode.org/project/metatag/-/blob/2.1.x/src/MetatagManag...

Remaining tasks

Identify solution
Update code

User interface changes

None

API changes

None

Data model changes

None

πŸ› Bug report
Status

Active

Version

2.0

Component

Code

Created by

πŸ‡¦πŸ‡ΊAustralia cb Sydney

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

Comments & Activities

  • Issue created by @cb
  • πŸ‡ΊπŸ‡ΈUnited States damienmckenna NH, USA
  • πŸ‡ΊπŸ‡ΈUnited States damienmckenna NH, USA

    It couldn't be completely excluded as that's where some of the token processing is done.

    Maybe we should start with updating the test coverage to track what the output should look like, and work from there?

  • πŸ‡¦πŸ‡ΊAustralia cb Sydney

    > It couldn't be completely excluded as that's where some of the token processing is done.

    Yeah cool, I assumed as much.

    > Maybe we should start with updating the test coverage to track what the output should look like, and work from there?

    Perfect!

    Thanks Damien.

Production build 0.71.5 2024