Page MenuHomePhabricator

Interface editors: Can change the heading on the main page
Closed, ResolvedPublicBUG REPORT

Description

The main page previously showed the name of the page as the heading. For example on https://nl.wiktionary.org/wiki/WikiWoordenboek:Hoofdpagina the heading of the page is "WikiWoordenboek:Hoofdpagina". This was problematic as the namespace is not always user friendly to newcomers.

Screen Shot 2022-01-06 at 9.38.17 AM.png (410×1 px, 101 KB)

Another common use case was hiding the main page heading via CSS inside MediaWiki:Common/Vector.css, however this also hid the heading on diff pages (see T38294). e.g.
Expected:

Screen Shot 2022-01-06 at 9.48.24 AM.png (780×2 px, 273 KB)

Actual:
Screen Shot 2022-01-06 at 9.48.37 AM.png (732×2 px, 278 KB)

A new change (T296969) allows more control/creativity over the text of the heading.
It is currently being used on Basque Wikipedia and MediaWiki.org

Screen Shot 2022-01-06 at 9.39.39 AM.png (354×1 px, 116 KB)

Screen Shot 2022-01-06 at 9.41.05 AM.png (260×1 px, 60 KB)

This change can also be used to hide the heading. To do this you can blank the heading message and remove any CSS in MediaWiki:Common.css or Vector.css that was previously hiding it (example on Italian Wikipedia ).

This is documented on https://meta.wikimedia.org/wiki/Small_wiki_toolkits/Starter_kit/Main_page_customization#Hide/change_the_text_of_the_header

Note, when blanking the header, this is currently supported only for the skins that the majority of our users use - Skin:Vector and Skin:Minerva (From 13th January [wmf17 release], this will also include Modern and Monobook and Timeless). To remove the CSS from Common.css totally before then, you should add corresponding CSS to MediaWiki:Modern.css, MediaWiki:Monobook.css, and MediaWiki:Timeless.css

Event Timeline

Jdlrobson updated the task description. (Show Details)
Jdlrobson moved this task from To Triage to Announce in next Tech/News on the User-notice board.

I guess the shortened version could be:
If you are an interface admin on your project, please see updated guidelines on how to hide/change the heading on your project's main page. In particular, action is needed to address a bug where the heading may be hidden on main page diff pages.

JJMC89 subscribed.

I didn't use that phrasing. Feel free to adjust.

The current wording in https://meta.wikimedia.org/wiki/Tech/News/2022/02 is

The heading on the main page can now be configured using MediaWiki:Mainpage-title-loggedin for logged-in users and MediaWiki:Mainpage-title for logged-out users. CSS previously used to hide the heading should be removed. [4]

Thanks for adding that, @JJMC89 !

Please make any necessary changes within the next 24 hours. Thanks.
I've also suggested (on the talkpage) that https://meta.wikimedia.org/wiki/Small_wiki_toolkits/Starter_kit/Main_page_customization could perhaps be marked for translation now, so that we can also link to that from this entry.

If I understand the intention of the task and the logic in https://gerrit.wikimedia.org/r/c/mediawiki/core/+/749580/5/includes/skins/Skin.php#153 correctly, it is missing && !$this->getRequest()->getRawVal( 'oldid' )

@Nirmos I don't think that's a bug. My thinking is that when inspecting an old revision the main page should look exactly as it was at the time, and that includes a heading not being shown.

for example on https://en.wikipedia.org/w/index.php?title=Hammond%27s_rice_rat&oldid=1042610777 the title of the page is "Hammond's rice rat" not "Old revision of Hammond's rice rat".

So if the main page title has been hidden it should also be hidden on old revisions.

Does that logic make sense?

The lack of a title on old ID renders probably also matches the CSS implemented today to hide the title (as it does on en.wp).

It's awesome, Thank you. I wished for this for really long time. I tried it on fawiki and wikidatawiki and I have two notes:

.page-Wikidata_Bar.action-view .firstHeading,
.page-Wikidata_Bosh_sahifa.action-view .firstHeading,
.page-Wikidata_Café.action-view .firstHeading,
.page-Wikidata_Forsíða_is.action-view .firstHeading,
.page-Wikidata_Forsíða_fo.action-view .firstHeading,
.page-Wikidata_Huvudsida.action-view .firstHeading,
.page-Wikidata_Main_Page_Simple_English.action-view .firstHeading,
.page-Wikidata_Pera_Seri.action-view .firstHeading,
.page-Wikidata_Κύρια_Σελίδα.action-view .firstHeading,
.page-Wikidata_Главна_страница.action-view .firstHeading,
.page-Wikidata_Главьна_страница.action-view .firstHeading,
.page-Wikidata_قهوهخانه.action-view .firstHeading,
.page-Wikidata_دیوەخان.action-view .firstHeading,
.page-Wikidata_मखपठ_mr.action-view .firstHeading,
.page-Wikidata_मखपठ_hi.action-view .firstHeading,
.page-Wikidata_メインページ.action-view .firstHeading,
.page-Wikidata_首頁.action-view .firstHeading,
.page-Wikidata_گت_صفحه.action-view .firstHeading,
.page-Wikidata_പരധന_ത.action-view .firstHeading,
.page-Wikidata_Umuna_a_Panid.action-view .firstHeading,
.page-Wikidata_الصفحة_الرئيسية.action-view .firstHeading,
.page-Wikidata_Ĉefpaĝo.action-view .firstHeading,
.page-Wikidata_صفحهٔ_اصلی.action-view .firstHeading,
.page-Wikidata_دەستپێک.action-view .firstHeading,
.page-Wikidata_Glavna_stranica.action-view .firstHeading,
.page-Wikidata_Kezdőlap.action-view .firstHeading,
.page-Wikidata_대문.action-view .firstHeading,
.page-Wikidata_Pagina_prima.action-view .firstHeading,
.page-Wikidata_Fandraisana.action-view .firstHeading,
.page-Wikidata_Laman_Utama.action-view .firstHeading,
.page-Wikidata_Veurblad.action-view .firstHeading,
.page-Wikidata_Hlavná_stránka.action-view .firstHeading,
.page-Wikidata_Glavna_stran.action-view .firstHeading,
.page-Wikidata_మదటి_ప.action-view .firstHeading,
.page-Wikidata_Ana_Sayfa.action-view .firstHeading,
.page-Wikidata_Головна_сторінка.action-view .firstHeading,
.page-Wikidata_Trang_Chính.action-view .firstHeading,
.page-Wikidata_Strumenti.action-view .firstHeading,
.page-Wikidata_Degemer.action-view .firstHeading,
.page-Wikidata_மதற_பககம.action-view .firstHeading,
.page-Wikidata_עמוד_ראשי.action-view .firstHeading,
.page-Wikidata_Hovedside.action-view .firstHeading,
.page-Wikidata_Hovudside.action-view .firstHeading,
.page-Wikidata_Početna_strana.action-view .firstHeading,
.page-Wikidata_ପରଧନ_ପ.action-view .firstHeading,
.page-Wikidata_Faqja_kryesore.action-view .firstHeading,
.page-Wikidata_Houptsyte.action-view .firstHeading,
.page-Wikidata_صفحہ_اول.action-view .firstHeading,
.page-Wikidata_Главна_страна.action-view .firstHeading,
.page-Wikidata_Pagrindinis_puslapis.action-view .firstHeading,
.page-Wikidata_Portada_galega.action-view .firstHeading,
.page-Wikidata_Głowny_bok.action-view .firstHeading,
.page-Wikidata_Hłowna_strona.action-view .firstHeading,
.page-Wikidata_Palanta.action-view .firstHeading,
.page-Wikidata_მთავარი_გვერდი.action-view .firstHeading,
.page-Wikidata_Sākumlapa.action-view .firstHeading,
.page-Wikidata_পরধন_প.action-view .firstHeading,
.page-Wikidata_Unang_Pahina.action-view .firstHeading,
.page-Wikidata_Pagina_principală.action-view .firstHeading,
.page-Wikidata_Váldosiidu.action-view .firstHeading,
.page-Wikidata_Destpêk.action-view .firstHeading,
.page-Wikidata_Pagina_principal.action-view .firstHeading,
.page-Wikidata_Esileht.action-view .firstHeading,
.page-Wikidata_Tuisblad.action-view .firstHeading,
.page-Wikidata_Acuèlh.action-view .firstHeading,
.page-Wikidata_頭版.action-view .firstHeading,
.page-Wikidata_Glavna_strana.action-view .firstHeading,
.page-Wikidata_Qhapaq_p_anqa.action-view .firstHeading,
.page-Wikidata_मय_प.action-view .firstHeading,
.page-Wikidata_ಮಯ_ಪಟष.action-view .firstHeading,
.page-Wikidata_Ojúewé_Àkọ́kọ́.action-view .firstHeading,
.page-Wikidata_Галоўная_старонка_be.action-view .firstHeading,
.page-Wikidata_Галоўная_старонка_be-tarask.action-view .firstHeading,
.page-Wikidata_Գլխավոր_էջ.action-view .firstHeading,
.page-Wikidata_หนาหล.action-view .firstHeading,
.page-Wikidata_ම_ප.action-view .firstHeading,
.page-Wikidata_دیوان_عام.action-view .firstHeading,
.page-Wikidata_Tungkaran_Tatambaian.action-view .firstHeading,
.page-Wikidata_Glavna_stranica_sh.action-view .firstHeading {
	display: none;
}
  • Is there a way to remove more than first heading? I want to get rid of this:
body.page-صفحهٔ_اصلی #ca-delete,
body.page-صفحهٔ_اصلی #deleteconfirm,
body.page-صفحهٔ_اصلی #t-cite,
body.page-صفحهٔ_اصلی #lastmod,
body.page-صفحهٔ_اصلی #siteSub,
body.page-صفحهٔ_اصلی #contentSub,
body.page-صفحهٔ_اصلی #catlinks,
body.page-صفحهٔ_اصلی #centralNotice,
body.page-درگاه_ورودی #siteSub,
body.page-درگاه_ورودی h1.firstHeading {
	display: none !important;
}

The Wikidata use case is interesting. I'm not 100% sure I understand the problem though? It's hiding the heading on https://www.wikidata.org/wiki/Wikidata:Caf%C3%A9 but I don't think that's a main page (or am I misunderstanding what you mean by "wikidata has a main page per language") ?

Under the hood it's just using Title::newMainPage and Title::isMainPage so in theory https://www.wikidata.org/wiki/MediaWiki:Mainpage/fr and https://www.wikidata.org/wiki/MediaWiki:Mainpage-title/fr etc could be used to define make the page pass true for isMainPage and to obtain and check whether the appropriate heading is blanked.

If we're not talking about main pages, but expanding the headings which can be hidden, I think we could at least do that for the use case of hiding. We'd need to check a config flag or message to identify titles to do that though:
https://github.com/wikimedia/mediawiki/blob/master/includes/skins/Skin.php#L154
Feel free to open a ticket tagged MediaWiki-Core-Skin-Architecture

Is there a way to remove more than first heading? I want to get rid of this:

I think TemplateStyles can be used for this, although it does note "Styles included by a template can currently affect content on the page outside of the content generated by that template, but this ability may be removed in the future and should not be relied upon.". Maybe TemplateStyles could reconsider that requirement for the Main page since its a special case. That would be my preferred way to solve this problem.

The Wikidata use case is interesting. I'm not 100% sure I understand the problem though? It's hiding the heading on https://www.wikidata.org/wiki/Wikidata:Caf%C3%A9 but I don't think that's a main page (or am I misunderstanding what you mean by "wikidata has a main page per language") ?

Half of them are main page per language and the other half is village pump in different languages. Cutting it to half is already a win though.

The fun thing is that it seems it became a quite a mess over the year. The main page in Persian (and possibly other languages) has been turned into a redirect: https://www.wikidata.org/w/index.php?title=Wikidata:%D8%B5%D9%81%D8%AD%D9%87%D9%94_%D8%A7%D8%B5%D9%84%DB%8C&redirect=no and as result the redirect page doesn't have the heading which is useless.

But maybe there is also a bug in the change now: https://www.wikidata.org/wiki/Wikidata:Main_Page?uselang=fa shows the heading for "Wikidata:Main Page" page and it's supposed to not do that.

Under the hood it's just using Title::newMainPage and Title::isMainPage so in theory https://www.wikidata.org/wiki/MediaWiki:Mainpage/fr and https://www.wikidata.org/wiki/MediaWiki:Mainpage-title/fr etc could be used to define make the page pass true for isMainPage and to obtain and check whether the appropriate heading is blanked.

If we're not talking about main pages, but expanding the headings which can be hidden, I think we could at least do that for the use case of hiding. We'd need to check a config flag or message to identify titles to do that though:
https://github.com/wikimedia/mediawiki/blob/master/includes/skins/Skin.php#L154
Feel free to open a ticket tagged MediaWiki-Core-Skin-Architecture

Is there a way to remove more than first heading? I want to get rid of this:

I think TemplateStyles can be used for this, although it does note "Styles included by a template can currently affect content on the page outside of the content generated by that template, but this ability may be removed in the future and should not be relied upon.". Maybe TemplateStyles could reconsider that requirement for the Main page since its a special case. That would be my preferred way to solve this problem.

Some are inside mw-content and possibly can be removed but not all. e.g. ca-delete

But maybe there is also a bug in the change now: https://www.wikidata.org/wiki/Wikidata:Main_Page?uselang=fa shows the heading for "Wikidata:Main Page" page and it's supposed to not do that.

You need to modify https://www.wikidata.org/wiki/MediaWiki:Mainpage-title/fa. Not sure if that's a bug or a feature. Perhaps when checking if a message is blanked, we could just check the English version. Not sure if there is a use case for different treatments on different languages.

Note eu.wikipedia.org is not hiding the heading, but changing the text https://eu.wikipedia.org/wiki/Azala to a welcome message.

Change 752176 had a related patch set uploaded (by Umherirrender; author: Umherirrender):

[mediawiki/core@master] Use messages mainpage-title/mainpage-title-loggedin in content language

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

Change 752176 merged by jenkins-bot:

[mediawiki/core@master] Use messages mainpage-title/mainpage-title-loggedin in content language

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

This also applied before with CSS-based hiding, but would be helpful to note everywhere now: if you do this, you should always define <h1> level heading manually on the page itself, otherwise your wiki’s main page has poor accessibility and violates WCAG 2.1 2.4.1 (A level).

Is there a way to remove more than first heading? I want to get rid of this:

body.page-صفحهٔ_اصلی #ca-delete,
body.page-صفحهٔ_اصلی #deleteconfirm,
body.page-صفحهٔ_اصلی #t-cite,
body.page-صفحهٔ_اصلی #lastmod,
body.page-صفحهٔ_اصلی #siteSub,
body.page-صفحهٔ_اصلی #contentSub,
body.page-صفحهٔ_اصلی #catlinks,
body.page-صفحهٔ_اصلی #centralNotice,
body.page-درگاه_ورودی #siteSub,
body.page-درگاه_ورودی h1.firstHeading {
	display: none !important;
}

This actually does a lot of different things. There are different ways to accomplish some of them:

body.page-صفحهٔ_اصلی #ca-delete,
body.page-صفحهٔ_اصلی #deleteconfirm,

This tries to make it harder to accidentally delete the main page (it's just two clicks away!). There's currently no better way to do this. Although, for enwiki, we have a hack in PHP: https://github.com/wikimedia/operations-mediawiki-config/blob/8f82df4e422405ff1d72593c2d7a85777f732e1e/wmf-config/CommonSettings.php#L2236-L2250

body.page-صفحهٔ_اصلی #t-cite,

This hides the "Cite this page" link in the sidebar. The best way to avoid this is to move your main page out of the main namespace (e.g. use "Wikipedia:Main Page" instead of just "Main Page").

body.page-صفحهٔ_اصلی #lastmod,

Not sure what this does, that element doesn't seem to exist. Maybe not needed?

body.page-صفحهٔ_اصلی #siteSub,

This element is already hidden by default (except for print), so if you need this, it's because you have some CSS elsewhere that shows it.

body.page-صفحهٔ_اصلی #contentSub,

This shouldn't be needed because this element is usually empty on the main page (it contains things like links to parent page on subpages, not sure what else can appear there).

body.page-صفحهٔ_اصلی #catlinks,

This hides the list of categories at the bottom, you can instead mark each category as hidden with __HIDDENCAT__, which will hide the box as well.

body.page-صفحهٔ_اصلی #centralNotice,

Hiding CentralNotice banners, not sure what to do about this.

For the heading to be effectively hidden (or replaced with a customized text), the message has to be implemented in the skin. It is currently the case for example with Vector, but still not with Monobook or Modern.

Therefore, to consistently hide the heading on all skins (which is the expected behavior on French wiki, and I presume on the other wikis too), we still have to add CSS in Common.css (or in Monobook.css, Modern.css, etc.)

So until the message is implemented in the remaining skins, this feature is not really usable…

@Od1n can you raise tickets requesting this for the individual skins? It's trivial for both of them to support this but I need community members like yourself asking for it :-).

It is still preferable to make this change and move styles to MediaWiki MediaWiki:Common.css and MediaWiki:Monobook.css/Modern.css given these styles are no longer "common" to all skins.

Currently French Wikipedia needs this change as the existing heading style breaks the sticky header and navigation on the site for logged in users (the sticky header visibility depends on the position or absence of the heading).

Screen Shot 2022-01-10 at 9.15.16 AM.png (250×2 px, 92 KB)

Jdlrobson updated the task description. (Show Details)

Some updates going out in this train based on feedback (available from Thursday 13th January if train goes to plan

  • This will support MonoBook, Timeless and Modern
  • Content language will be used instead of site language, so only need to blank the content language message.

Just to be clear, I tested and gave as examples the Monobook and Modern skins, but it was out of habit:

Nowadays, Modern can be tried using the useskin=modern query string, but it's no longer listed in the preferences. Same goes with the CologneBlue skin.

Change 776234 had a related patch set uploaded (by Gerrit Patch Uploader; author: Fernand Dell):

[mediawiki/skins/CologneBlue@master] Use html-title-heading template data provided by core

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

Change 776234 merged by jenkins-bot:

[mediawiki/skins/CologneBlue@master] Use html-title-heading template data provided by core

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

Change 894203 had a related patch set uploaded (by Winston Sung; author: Winston Sung):

[mediawiki/core@master] Use messages mainpage-title/mainpage-title-loggedin in page view language

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

Change 894203 merged by jenkins-bot:

[mediawiki/core@master] Use messages mainpage-title/mainpage-title-loggedin in page view language

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