Extension:HidePrefix

From MediaWiki.org
Jump to navigation Jump to search
MediaWiki extensions manual
OOjs UI icon advanced.svg
HidePrefix
Release status: unmaintained
Implementation User interface
Description Hide prefix in links and page titles.
Author(s) Van de Buggertalk
Latest version 0.0.1 (2012-03-17)
MediaWiki 1.16+ (probably will work with earlier versions)
PHP 5.2+
Database changes No
License GNU Affero General Public License 3.0 or later
Download
Hooks used
LinkBegin
BeforePageDisplay
Translate the HidePrefix extension if it is available at translatewiki.net
Check usage and version matrix.

What?[edit]

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, result will be just `FAQ' without the `Help:' prefix.

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

Why?[edit]

I as a user do not care too much about 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 looks ugly to me.

Namespace of target 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, actually it does not matter whether that page is in `User' namespace or not. But again, the prefix looks very ugly, so many wikieditors use `[[User:Van de Bugger|Van de Bugger]]' to suppress the prefix — look into 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 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 hide it at every link manually? Let me write an extension which will hide the prefix in all the links. Everywhere.

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

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

Download[edit]

The extension can be retrieved directly from Git [?]:

  • Browse code
  • Some extensions have tags for stable releases.
  • Each branch is associated with a past MediaWiki release. There is also a "master" branch containing the latest alpha version (might require an alpha version of MediaWiki).

Extract the snapshot and place it in the extensions/HidePrefix/ directory of your MediaWiki installation.

If you are familiar with git and have shell access to your server, you can also obtain the extension as follows:

cd extensions/
git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/HidePrefix.git

Installation[edit]

  • Download and place the file(s) in a directory called HidePrefix in your extensions/ folder.
  • Add the following code at the bottom of your LocalSettings.php:
    require_once "$IP/extensions/HidePrefix/HidePrefix.php";
    
  • Yes Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.

See also[edit]

  • Extension HideNamespace — This extension drops prefix in page title and provides some control (e. g. hide prefix only of pages in specific namespace; control prefix visibility from within page content), but it does not affect links.