Page MenuHomePhabricator

Formalize Main page heading behaviour
Closed, ResolvedPublic3 Estimated Story Points

Description

Most projects hide the heading on the main page by default. This is done, by blanking the associated message, however, this often results in an empty h1 being output to the page.

In Minerva projects see a user specific message "Welcome, USERNAME!" at the top of the page.

This issue is now showing up as part of Desktop Improvements (Vector 2022) where some editors would like to show the heading on the main page, with text other than the page name,

QA steps

No need to test in production.

Acceptance criteria

  • On a default MediaWiki instance the heading is present on the main page for Vector
  • On a default MediaWiki instance the heading is not present on the main page for Minerva (this will be changed in T293470)
  • An editor can change the main page title to "Welcome to {{PROJECTNAME}}!"
  • The title for logged in users and anonymous users is different.
  • The <title> tag in the head is not impacted by the change

Developer notes

https://gerrit.wikimedia.org/r/c/mediawiki/core/+/734420 would allow editors to remove the page title from the main page by blanking the page MediaWiki:Mainpage-title

Changes in Vector and Minerva would then be made to check for an empty string

e.g.

<h1 id="firstHeading">{{{html-title}}}</h1>

becomes

{{#html-title}}}<h1 id="firstHeading">{{{.}}}</h1>{{#html-title}}}

Inside Minerva, we'd need to refactor SkinMinerva::getHeadingHtml to use html-title after the core change has been merged and to address the <title> issue, we'd remove the code inside SkinMinerva::prepareHeaderAndFooter:

if ( $title->isMainPage() ) {
			$pageTitle = '';
			$msg = $this->msg( 'mobile-frontend-logged-in-homepage-notification', $user->getName() );

			if ( $user->isRegistered() && !$msg->isDisabled() ) {
				$pageTitle = $msg->text();
			}

			$out->setPageTitle( $pageTitle );
		} else

QA Results - Beta

ACStatusDetails
1T255682#7558065
2T255682#7558065

QA Results - Prod

Not Applicable

Related Objects

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes

Change 607254 had a related patch set uploaded (by Ammarpad; owner: Ammarpad):
[mediawiki/skins/MinervaNeue@master] Allow projects to disable Mobile welcome message

https://gerrit.wikimedia.org/r/607254

Change 607254 merged by jenkins-bot:
[mediawiki/skins/MinervaNeue@master] Allow projects to disable Mobile welcome message

https://gerrit.wikimedia.org/r/607254

Thanks for the patch @Ammarpad - this should be ready to test on https://de.m.wikipedia.beta.wmflabs.org/wiki/Wikipedia:Hauptseite soon. Let me know @XanonymusX if that resolves your problem!

@PerfektesChaos: FYI. Thanks for the quick solution, the new main page is coming soon, so this will definitely be taken into consideration for the mobile layout!

https://de.m.wikipedia.beta.wmflabs.org/wiki/Wikipedia:Hauptseite

Before:

Screen Shot 2020-06-23 at 9.40.51 AM.png (1×2 px, 191 KB)

After blanking message:
Screen Shot 2020-06-25 at 9.32.34 AM.png (1×852 px, 85 KB)

Unfortunately there is small margin at the top of the page due to the empty pre-content element that needs to be fixed stil..

Yep, however it looks like the message needs to be blanked for every language separately! Is that what is expected? Right now we have done it for de, en and it, but we cannot do that for any language a user might have set in their preferences.

If you want to block it on all languages you'd need to use the WikimediaMessages extension.

The new dewiki main page is now live (https://de.m.wikipedia.org/wiki/Wikipedia:Hauptseite). If I’m not mistaken, there is still a larger margin on top, shouldn’t it be gone by now?

It hasn't been fixed yet. Thanks for flagging. That's a bug on our end. An empty h1 is also being outputted :-/

Change 737112 had a related patch set uploaded (by Jdlrobson; author: Jdlrobson):

[mediawiki/skins/MinervaNeue@master] Minerva uses core page title handling

https://gerrit.wikimedia.org/r/737112

Jdlrobson renamed this task from Unblock editors by allowing them to disable the "Welcome, Username!" message at the top of the mobile main page to Formalize Main page heading behaviour.Nov 29 2021, 7:13 PM
Jdlrobson added a project: MW-1.38-release.
Jdlrobson updated the task description. (Show Details)

Change 734420 had a related patch set uploaded (by Jdlrobson; author: Jdlrobson):

[mediawiki/core@master] Allow editors to customize the main page title

https://gerrit.wikimedia.org/r/734420

  • On a default MediaWiki instance the heading is present on the main page for both Vector and Minerva (this was broken by T296109)

Just to be clear, this task / the corresponding patch aaf015917408 did not break a formerly perfect solution, but rather visually restored the former status quo, which has ever been since dd00aa5a601e (authored by @Jdlrobson) that there’s no title on main pages for anons. (The HTML code did change compared to that, but this task is about the visual appearance.)

Jdlrobson updated the task description. (Show Details)

Thanks for the correction. I can confirm that Minerva didn't show the heading on the main page before the change: https://patchdemo.wmflabs.org/wikis/7896048254/wiki/Main_Page

  • An editor can change the main page title to "Welcome to {{PROJECTNAME}}!"
  • The title for logged in users and anonymous users is different.
  • Editors can blank the associated message to remove the heading on both Vector and Minerva.
  • Editors can blank the associated message for logged in users to hide the logged-in user heading.
  • The <title> tag in the head is not impacted by the change.

I note that overrides from Minerva currently do impact both the first heading and the document <title>. E.g. both are currently overridden to "Welcome, Username", with the document title following the default non-mainpage pattern as "Welcome, Username - Wikipedia". Is that intended to change as implied by the AC or stay as-is?

Is that intended to change as implied by the AC or stay as-is?

No, the <title> tag should not be impacted by these changes. The fact Minerva changes it is a bug that will be fixed separately as part of T265892. The goal of these changes is to make Minerva work consistently with Vector.

Change 734420 merged by jenkins-bot:

[mediawiki/core@master] Allow editors to customize the main page h1 heading text

https://gerrit.wikimedia.org/r/734420

Change 734420 merged by jenkins-bot:

[mediawiki/core@master] Allow editors to customize the main page h1 heading text

https://gerrit.wikimedia.org/r/734420

If I understand correctly, this patch will change the first heading of all main pages to say "Main Page" instead of its actual project-specific or localised page title. That is likely to cause confusion as the first heading is generally understood to be the linkable page title under which the page exists. For the main page, this is configured by the mainpage interface message, with the "DISPLAYTITLE" magic word controlling any differences in casing, spacing, or italics.

As example of non-default translation, officewiki calls this "Homepage", and nl.wiktionary.org calls this "WikiWoordenboek: Hoofdpagina" (with displaytitle adding an optional space after colon).

It seems unintended by the task description that:

  • Translators may control these three messages differently, which is fragile/confusing and probably coordination overhead we can avoid.
  • Until translation is complete, titles are likely to revert to English for many communities if deployed as-is.
  • Overriding custom display titles back to the default title translation seems unintended.

The general pattern we follow in cases like this, when multiple levels of override are supported cascading down to a single lower level value, is to leave the higher level overrides empty by default using "-" and for the output handling to check Message::isDisabled() before use and otherwise performing the same default as for non-mainpage titles. Perhaps that would help here as well? That would also remove the extra translation effort.

An example of this in practice is revision-info-current which is an optional override for revision-info but it does not duplicate its content. Here, mainpage-title and mainpage-title-loggedin are essentially optional overrides for out->getPageTitle.

If I understand correctly, this patch will change the first heading of all main pages to say "Main Page" instead of its actual project-specific or localised page title. That is likely to cause confusion as the first heading is generally understood to be the linkable page title under which the page exists. For the main page, this is configured by the mainpage interface message, with the "DISPLAYTITLE" magic word controlling any differences in casing, spacing, or italics.

Understood. The patch to WikimediaMessages I'm working on locally should deal with this.

Change 743044 had a related patch set uploaded (by Jdlrobson; author: Jdlrobson):

[mediawiki/extensions/WikimediaMessages@master] Allow for progressive roll out of main page customization

https://gerrit.wikimedia.org/r/743044

Change 743050 had a related patch set uploaded (by Jdlrobson; author: Jdlrobson):

[mediawiki/core@master] Main page messages are disabled by default

https://gerrit.wikimedia.org/r/743050

The general pattern we follow in cases like this, when multiple levels of override are supported cascading down to a single lower level value, is to leave the higher level overrides empty by default using `"-"` and for the output handling to check `Message::isDisabled()` before use and otherwise performing the same default as for non-mainpage titles. Perhaps that would help here as well? That would also remove the extra translation effort.

I hadn't considered this approach TBH. It seems like it might be better than the WikimediaMessages approach in https://gerrit.wikimedia.org/r/743044 as editors will be able to opt in without a configuration change.

Are there any drawbacks to https://gerrit.wikimedia.org/r/743050 ?

Change 743044 abandoned by Jdlrobson:

[mediawiki/extensions/WikimediaMessages@master] Allow for progressive roll out of main page customization

Reason:

https://gerrit.wikimedia.org/r/743044

Change 743050 merged by jenkins-bot:

[mediawiki/core@master] Skin: Disable the new main page messages by default

https://gerrit.wikimedia.org/r/743050

Jdlrobson updated the task description. (Show Details)

Given the new approach using isDisabled it makes sense to handle blanking use case in a separate ticket: T297019

The message seems to be missing a comma that should probably be there.

Screen Shot 2021-12-06 at 8.57.49 AM.png (354×1 px, 85 KB)

Edtadros subscribed.

Test Result - Beta

Status: ✅ PASS
Environment: beta
OS: macOS Monterey
Browser: Chrome
Device: MBP
Emulated Device:NA

Test Artifact(s):

QA Steps

No need to test in production.

✅ AC1: As an anonymous user visit https://en.wikipedia.beta.wmflabs.org/wiki/Main_Page?safemode=1 and check the heading says "Welcome to the Beta cluster!" Confirm this text is not in the browser tab/window title (<title>)

Screen Recording 2021-12-08 at 3.49.17 PM.mov.jpg (470×868 px, 202 KB)

✅ AC2: As a logged in user visit https://en.wikipedia.beta.wmflabs.org/wiki/Main_Page?safemode=1 and check the heading includes your username. Confirm this text is not in the browser tab/window title (<title>)
Screen Shot 2021-12-08 at 4.06.57 PM.png (471×868 px, 126 KB)

Looks good, resolving