MediaWiki Tweaks

From JonWiki

jontse.com > HOWTOs > MediaWiki Tweaks
Jump to: navigation, search

I must say I really like MediaWiki. As I explore its capabilities more, I'll post anything interesting or novel here. This serves more as a reminder in case I need to set a MediaWiki install up again.

Contents

Inline LaTeX Markup

  1. Obtain MediaWiki from http://www.mediawiki.org/
  2. Follow the installation instructions for MediaWiki.
  3. For the inline LaTeX markup, http://www.mediawiki.org/wiki/Manual:Math
  4. We'll need texvc, which is included with MediaWiki, but we need to compile ocaml from http://caml.inria.fr/. For DreamHost, use this guide: http://wiki.dreamhost.com/Unison

MediaWiki Skins

Some googling turned up http://www.paulgu.com/. He's made a pretty snazzy MediaWiki Skin, called GuMax, which you see on this site. I really like it.

I made some changes to the CSS templates, but that shouldn't be too difficult to sort out.

Here's some random notes on GuMax:

  • The tabs have been moved to the bottom, which is okay I suppose.
  • The nav sidebar is now strung across the top. Any extra menus you have get strung underneath, and it looks funny, so don't do it.

Adding Breadcrumbs

I decided I needed some snazzy breadcrumbs, so I found this: http://www.ehartwell.com/InfoDabble/MediaWiki_extension:_BreadCrumbs2

The instructions there are pretty impeccable, but you must make sure to use the MediaWiki:Breadcrumbs page. Note the lowercase "c." I had been using MediaWiki:BreadCrumbs, and I couldn't figure out why it was broken till I re-did the whole RTFM thing.

Also, I CSS-fied the breadcrumbs, which was pretty important.

Adding a Purge Tab

When you're doing dev work, caches suck. So, I added a purge tab to each page on the site to fix this issue.

  1. Create a file called add_remove_tabs.php or something in your extensions directory.
  2. Use the require_once directive to include it in your LocalSettings.php
  3. Stick the following code in your add_remove_tabs.php:
<?php
$wgHooks['SkinTemplateContentActions'][] = 'ReplaceTabs';
 function ReplaceTabs ($content_actions) {
      $purge_action['purge'] = array(
        'class' => false,
        'text' => 'Purge',
        'href' => 'http://www.jontse.com/index.php?title='.$_GET['title'].'&action=purge',
      );
      $content_actions = array_merge($content_actions,$purge_action);
      return true;
 }
?>

Adding Source Highlighting

See here: http://www.mediawiki.org/wiki/Extension:SyntaxHighlight_GeSHi

Note that you need both the MediaWiki extension and GeSHi, which is a standalone PHP syntax highlighting engine.

Adding Useful Parser Keywords

See here: http://www.mediawiki.org/wiki/Extension:ParserFunctions

This basically lets you do things like have if/else and other nifty features within your templates. Very handy.