Technology blog

Mediawiki tips and tricks

Mediawiki secrets

Some quick tips and tricks for Mediawiki users.

  • W3C HTML compliant pages:
    • Latest versions of Mediawiki outputs pages in HTML5 doctype. However, it can be turned off to make it W3C HTML compliant simply by adding the following line to LocalSettings.php:
      •  $wgHtml5 = false;

  • Facebook and other social network friendly pages:
    • It is often seen that Facebook and many other websites fetches the wrong portion of the contents from Mediawiki pages and thus making the posts unattractive. This issue can be solved by making use of the Description2 extension.

  • Find extensions used by other Mediawiki administrators:
    • There are times you might have wondered what all extensions are used by other Mediawiki instances for achieving those cool features you really liked. You can find them out easily by going to Special:Version page of any wiki instance.

  • Put special characters in Mediaiki articles:
    • If you ever across situations where you want to special characters that are not available on keyboard, you can make use of

  • Make articles reachable by using trees:
    • Articles and their categories forms a tree structure and users will find it easy to reach articles, if they can navigate through these visually. It can be done it two ways:

  • Use lower case page names:
    • Mediawiki does not allows this by default and many people this its impossible to have lower case page names in Mediawiki. However, this can be achieved by adding the following like to LocalSettings.php file:
      • $wgCapitalLinks = false;

  • Syntax Highlighting:

  • Enable/Disable table of contents in pages:
    • Mediawiki creates table of contents on pages by default. If you don't want table of contents of a particular page, it can be done by adding __NOTOC__ to the article.
    • If table of contents has to be disabled globally on all pages, it can be done by using NoTOC extension.
    • While using the above extensions, you can make exceptions for particular pages to display table of contents, it is done by adding  __TOC__ to the article.

  • Embedding recent changes:
    • You can embed recent changes on the wiki instance on any page by adding {{Special:RecentChanges}} at the desired page. This usually displays a long list of recent edits on the wiki. The number of recent edits shown can be specified by {{Special:RecentChanges/7}}, where is the number of edits to be shown.
    • If you want to publish these recent edits as rss feed, use this extension:

  • Exclude pages from appearing in recent changes:
    • Add the following code to LocalSettings.php
$wgHooks['SpecialRecentChangesQuery'][] = 'rcExcludeSandbox';
function rcExcludeSandbox( $conds ) {
    $dbr = wfGetDB( DB_SLAVE );
    $conds[] = 'rc_title != ' . $dbr->addQuotes( 'Bbroy' );
    return true;
where Bbroy is the title of the page to be excluded.

More Mediawiki Tips