Duplicate title on node revision page

Created on 18 March 2024, 9 months ago
Updated 19 March 2024, 9 months ago

Problem/Motivation

On a regular node view page (node/123), the page title block is visible, while the entity label in the node template is not shown.

On a node revision page (node/123/revisions/456/view), both the page title block and the entity label in the template are shown.

Steps to reproduce

Install a fresh Drupal site, using standard profile.
(e.g. using drupal/recommended-project and ddev)

Create a page content, call it "Example page".
Edit to create revisions.
Open an revision page like /node/1/revisions/1/view.

Expected: The string "Example page" appears once.

Actual: The string "Example page" appears twice.

Background

On a revision page, the node_is_page() function returns FALSE, so the 'page' variable passed to the node template is FALSE, so the title is shown.

Proposed resolution

The first idea would be to let node_is_page() detect revision pages.

This would have a BC impact on any custom or contrib code or project that relies on the title being shown.
E.g. if a projects intentionally hides the page title on revision pages to avoid the duplication, changing this in core would result in no title being shown on node revision pages.

But the real truth is that this entire mechanism of determining whether we are on a "page" feels very out of place and time, and should be replaced with something smarter and cleaner.

Imo, the controller should be responsible for passing a 'page' parameter into the render element.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

๐Ÿ› Bug report
Status

Needs work

Version

11.0 ๐Ÿ”ฅ

Component
Node systemย  โ†’

Last updated about 21 hours ago

No maintainer
Created by

๐Ÿ‡ฉ๐Ÿ‡ชGermany donquixote

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024