Jump to content

Extension:HidePrefix

From mediawiki.org
MediaWiki extensions manual
HidePrefix
Release status: unmaintained
Implementation User interface
Description Hide prefix in links and page titles.
Author(s) Van de Buggertalk
Maintainer(s) Kizule
Latest version 0.1.0 (2022-05-12)
MediaWiki 1.35+
Database changes No
Licence GNU Affero General Public License 3.0 or later
Download
Translate the HidePrefix extension if it is available at translatewiki.net

The HidePrefix extension hides prefix in links and page titles.

For example, wikitext '[[Help:FAQ]]' normally results in link 'Help:FAQ'. If this extension is enabled, the result will be just 'FAQ' without the 'Help:' prefix.

The same is true for page titles. The 'FAQ' page in the 'Help' namespace normally has the title 'Help:FAQ'. If this extension is enabled, the visible page title will be just 'FAQ' without the 'Help:' prefix.

Rationale

[edit]

As a user, I do not care too much about the namespace of the link target page. To me, there is no big difference between 'Help:FAQ' and 'Manual:FAQ' (especially if one of them is a redirection to another). But both these prefixes look ugly to me.

The target's namespace is often clear from context. If you see 'Author: User:Van de Bugger' it is clear that 'User:Van de Bugger' is a link to her/his personal page. Moreover, it does not matter whether that page is in the 'User' namespace. But again, the prefix looks very ugly, so many wikieditors use '[[User:Van de Bugger|Van de Bugger]]' to suppress the prefix — look at the infobox on the right.

Prefixes look especially ugly if there is a long list of links with the same prefix. For example, look at the list of Extensions used on Wikimedia. More than 100 occurrences of the prefix 'Extension:' just clutter the screen and do not add any value. (BTW, did you notice that I had to use '[[:Category:Extensions used on Wikimedia|Extensions used on Wikimedia]]' to suppress ugly 'Category:' prefix?)

Thus, if I want to hide the ugly prefix so often, why should I have to hide it manually at every link? Let me write an extension that will hide the prefix in all the links. Everywhere.

BTW, the prefix is hidden in the link text, but it is still available — if one hovers the mouse cursor over the link, the tooltip will show the full target page title, including the prefix.

The same reasoning applies to page titles. A prefix looks ugly and does not add any value to the reader, because just above the page title (at least, in the Vector skin), there are namespace tabs, and the leftmost tab shows the namespace name.

Installation

[edit]
  • Download and move the extracted HidePrefix folder to your extensions/ directory.
    Developers and code contributors should install the extension from Git instead, using:
    cd extensions/
    git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/HidePrefix
    
  • Add the following code at the bottom of your LocalSettings.php file:
    wfLoadExtension( 'HidePrefix' );
    
  • Yes Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.

See also

[edit]
  • Pipe trick, the simpler way to achieve the same rendering, but requiring the right syntax on each link