Sunday, 22 March 2015

Change MediaWiki Logo

Once you have your MediaWiki up and running (check out my blog post which explains how to do this,) there are a few things you will want to do. One of the first is to replace the MediaWiki logo, with one of your own. The MediaWiki logo shown even suggests that you do this and drops a hint on how you go about this.

The first thing you need to do it to copy your new logo to the correct place. The logo you want to display should be copied to the location:


The logo should be 135 x 135 pixels in size, otherwise you will not see all of it. If it's not square just make sure that the largest number of pixels in x or y is 135. I tend to use .png of .jpg images. Others may work, but I have not tested them!

Once this in place you now have to change your settings file to point to the new logo.

To change the logo it suggests you 'Set $wgLogo to the URL path to your own logo image.'

Most modifications you make within MediaWiki are within the LocalSettings.php file. You will find this in the /var/lib/mediawiki/ folder. That may sound more complex than it is, but don't worry, it really is simple!

To change this file, in the terminal, you need to type

sudo nano /var/lib/mediawiki/LocalSettings.php

For those that don't know.
  • sudo - gives you administrator rights to change the file.
  • nano - is a text editor. There are others you can use but for demonstration purposes I am using nano. 
  • /var/lib/mediawiki/LocalSettings.php - this is the location and name of the file you want to change. The file is LocalSettings.php, which is in location /var/lib/mediawiki/

This will open the LocalSettings.php file for you to edit.

You should see something like this.

# This file was automatically generated by the MediaWiki 1.19.20+dfsg-0+deb7u3
# installer. If you make manual changes, please keep track in case you
# need to recreate them later.
# See includes/DefaultSettings.php for all configurable settings
# and their default values, but don't forget to make changes in _this_
# file, not there.
# Further documentation for configuration settings may be found at:

# Protect against web entry
if ( !defined( 'MEDIAWIKI' ) ) {

## Uncomment this to disable output compression

Scroll down to the very bottom of this file using the arrow keys, and you should see the following two lines.

# End of automatically generated settings.
# Add more configuration options below.

This is where you should put your customised option. So below these two lines type in the following.

$wgStylePath = " $wgScriptPath/skins";
$wgLogo = "$wgStylePath/common/images/newLogo.jpg";

You should change newLogo.jpg to the name of your logo.

Now press ctrl-x to exit. You will be asked if you want to 'Save modified buffer', Simply press y and then press return. This should exit from nano having saved your file.

Now when you go to the main screen of your MediaWiki page you will see your new logo.

I have simply used the header block from my blogpage, as you can see below.

There you go, you have completed the first step to customising your MediaWiki page. A big improvement over the standard logo!

No comments:

Post a Comment