Page MenuHomePhabricator

Allow suppressing page title output
Open, MediumPublicFeature

Description

Author: sandvik

Description:
Could a future MediaWiki have a configuration option to leave out the main page <h1>Main Page</h1> tag so that there's no need to patch .js files for removing this tag – this means each time MediWiki is updated, the patches have to be rolled in. It would be better if this main page <h1> tag could be enabled or disabled per configuration setting.

Details

Reference
bz6129

Event Timeline

bzimport raised the priority of this task from to Low.Nov 21 2014, 9:17 PM
bzimport set Reference to bz6129.
bzimport added a subscriber: Unknown Object (MLST).

sandvik wrote:

Hmm, mediawiki has it removed, and many other sites use various Javascript hacks to have it removed...

rotemliss wrote:

(In reply to comment #2)

Hmm, mediawiki has it removed

Do you mean the English Wikipedia?

BTW, I support allowing this title to be removed: why should we have the big
"Main Page" title? Normally, users know that if there is no title, it is the
main page. However, I support creating a configuration option (e.g.
$wgShowMainPageTitle), not removing the title for all the sites.

sandvik wrote:

Yes, $wgShowMainPageTitle, is very good.

rotemliss wrote:

Patch (trunk)

This patch creates the configuration setting $wgHideMainPageTitle, which hides
both the title "Main Page" (in every language) and the sub-title "From
{{SITENAME}}" when on.

Attached:

robchur wrote:

Don't like it either. Hiding information for the sake of aesthetics is
useless...use CSS for this...I'd support adding a conditional CSS class to the
heading when viewing the main page.

ayg wrote:

So we would have <h1 style="display: none;">Main Page</h1>? What's the point in
including it altogether, then? The <title> will stay say "Main Page".

robchur wrote:

No, we'd have <h1 class="maintitle"> or somesuch.

Added the css tweak to the FAQ:
http://www.mediawiki.org/w/index.php?title=Manual:FAQ&diff=93496&oldid=85303

Marking bug as WONTFIX (per design: comment #1)

Re-opening. This is a semi-frequent feature request and I don't see a particularly good reason for it not to be a feature in core. The reality is that plenty of sites, including the English Wikipedia, do hide the page title of particular pages. This doesn't need to be intentionally made difficult (compare to the |link= debate for image syntax).

I see two possible implementation options using a NOTITLE magic word:
(1) the magic word removes the <h1> altogether;
(2) the magic word modifies the <h1> to include a "hidepagetitle" CSS class that's defined in skins/common/ somewhere as being display:none;

ayg wrote:

What's wrong with a CSS fix here? A NOTITLE magic word seems prone to abuse, since any user could add it to any page they can edit.

(In reply to comment #11)

What's wrong with a CSS fix here? A NOTITLE magic word seems prone to
abuse, since any user could add it to any page they can edit.

I don't think a CSS implementation is a bad idea here (see option 2), I just don't think requiring every new wiki admin who wants to hide the title of their main page (or whatever page) to edit their CSS individually is a very good design/practice for MediaWiki.

I don't see how NOTITLE is more prone to abuse than blanking a page, filling it with "penis" written over and over, adding NOINDEX (if it's not in a content namespace), etc.

ayg wrote:

(In reply to comment #12)

I don't see how NOTITLE is more prone to abuse than blanking a page,
filling it with "penis" written over and over, adding NOINDEX (if it's not
in a content namespace), etc.

Granted.

I think another advantage to a system like this is that, by modifying the generated HTML with an additional CSS class and storing it in the default MediaWiki skin files, you'd avoid the 30-day caching issues that often come with changes to the site-wide CSS pages.

While it's true that a Main Page doesn't change titles very often, the other use-cases for this template may mean that the page title could change, making body.page-hackery not very practical or efficient.

The working implementation of magic word usage tracking (it's used with NOINDEX and maybe some other magic right now) also makes this feature less of a big deal, in my view.

Changing bug summary from "Allow suppressing title output on the main page" to "Allow suppressing page title output".

ayg wrote:

What are the use-cases beyond the main page? I haven't seen any mentioned. Is anyone actually doing this already with CSS for non-main pages?

(In reply to comment #15)

What are the use-cases beyond the main page? I haven't seen any mentioned. Is
anyone actually doing this already with CSS for non-main pages?

I assume there are other use-cases given the train wreck of an extension at http://www.mediawiki.org/wiki/Extension:NoTitle. The implementation there and the talk page suggest that people have used it on other pages beside the Main Page (there's a section regarding its use with tranclusion), but I'm not sure how easy it would be to search for specific use-cases. The fact that Special:Version is intentionally excluded from search engines and the fact that magic word usage tracking has historically not existed don't aid the hunt.

There have even been several rewrites, including one for 1.16 in May 2010, making it clear to me that this is a desired feature for MediaWiki, though.

*Bulk BZ Change: +Patch to open bugs with patches attached that are missing the keyword*

sumanah wrote:

Rotem, thank you for your patch. Your patch no longer applies to trunk, and I'm adding the "reviewed" keyword; if you'd like to get more discussion and suggestions for revision, please feel free to remove it and add "need-review," or ask for suggestions on the MediaWiki-General IRC channel on freenode, or the wikitech-l mailing list https://lists.wikimedia.org/mailman/listinfo/wikitech-l . Thanks again.

(In reply to comment #15)

What are the use-cases beyond the main page? I haven't seen any mentioned.
Is
anyone actually doing this already with CSS for non-main pages?

In multilingual sites the Main Page = Special:MyLanguage/Main_Page and these are many pages.

Going back to the original request:

(In reply to comment #0)

Could a future MediaWiki have a configuration option to leave out the main
page
<h1>Main Page</h1> tag so that there's no need to
patch .js files for removing this tag -- this means each time MediWiki is
updated, the patches have to be rolled in. It would be better if this
main page <h1> tag could be enabled or disabled per configuration setting.

This can be done easily via MediaWiki:Common.css, which will not be modified in upgrades.

On the other hand, it is a usual practice for any website not to call explicitly "Main Page", "Homepage", etc the main page. Just go out there and try to find such explicit mention in any decent website.

Therefore, I think the proper fix for this report would be to offer out of the box no heading for the article defined as Main Page. The heading would still be there, just hidden via CSS. This way webmaster interested in having it could enable it by simply rewriting the rule at MediaWiki:Common.css.

If you think this solution is wrong then let's resolve this as WONTFIX, pointing people with this problem to the right solution.

Given the amount of people who used {{DISPLAYTITLE:<span style="display:none">{{FULLPAGENAME}}</span>}} (before that was disabled), and the number of people who use css to disable the title on a specific page, I think having a NOTITLE magic word is justified.

*I don't think telling users to modify the CSS is a good solution. User's shouldn't have to know CSS to do something this common.
**Additionally, I think non-admins should be able to hide the heading, for use-cases like the Asia example
*I personally think its good to have it as a general magic word, as often people disable the title so they can make some sort of fancier heading for the page. For example https://en.wikivoyage.org/wiki/Asia
*I do not think we should out of the box disable main page heading. This looks weird for people who just write out a non-fancy page there (That's just my opinion)
*I do not think this would be open to any more abuse then average heading since the title is still in the url/title bar. At worst someone could make a page that looks like at first glance its title is something else. They could probably already do that with some fancy position:absolute.

Gerardduenas raised the priority of this task from Low to Medium.Jul 6 2015, 8:29 PM
Gerardduenas subscribed.

I think we should come up with an alternative to Javascript. We haven't gone any further and I think it is necessary. I find really interesting the magic word idea

Tacsipacsi changed the subtype of this task from "Task" to "Feature Request".Apr 7 2022, 5:24 PM

Main page titles are now determined by the MediaWiki messages mainpage-title and mainpage-title-loggedin (for logged-out and logged-in users respectively) since T255682. The <h1> can be hidden by setting both messages to empty (or only either of them if the title should still be displayed to logged-out or logged-in users). For other use cases, this feature would likely be more dangerous than useful, so I’m inclined to close this task as declined.