How to change the logo in MediaWiki
MediaWiki comes prepackaged with a default logo image. If you want to change it with your own logo, you can achieve this by doing a couple of things. You have to upload the new image on your MediaWiki hosting account and you have to modify a line in the LocalSettings.php file of your MediaWiki.
- First you have to upload the new logo on your hosting account. One way for HostKnox customers to do that is from the Files section of the Pixie control panel. Another approach is to use an FTP client (e.g. FileZilla).
You're not required to upload the logo in a particular folder of your MediaWiki. The path to it can be specified later in the LocalSettings.php file. It can be in the root MediaWiki folder on the account or it can be in a subfolder. To keep all the logo images together, if you want to, you can upload it in the same folder in which the default logo is located. In MediaWiki versions 1.24 and newer the logo is in the folder /resources/assets (in older versions it's in /skins/common/images). This is the path in relation to the root MediaWiki folder. So, for example, if your MediaWiki is installed directly in the public_html folder on the hosting account, the path to that folder will be public_html/resources/assets. If you prefer it, you can upload the logo directly in the root MediaWiki folder (e.g. public_html).
- Once you have the logo on your hosting account you have to specify it's name and path in the LocalSettings.php file of your MediaWiki. In MediaWiki 1.24 and newer versions find the following line in LocalSettings.php:
$wgLogo = "$wgScriptPath/resources/assets/wiki.png";
For older versions and for those upgraded to 1.24 from older versions the corresponding line will be a bit different:
$wgLogo = "$wgStylePath/common/images/wiki.png";
These examples are for the default logo that comes prepackaged with MediaWiki. If it has already been changed, the filename and the path may be different. Just make sure you find the variable $wgLogo.
Note that in the above two default examples in addition to the different folder paths, the path variable is different too. In the first example the script path is included. The script path is the folder on the account in which MediaWiki is installed, while in the second example the style path is used instead. The style path is the folder where the skins are contained (simply put it corresponds to the skins folder).
Let's assume that the filename of the logo that you uploaded is new-logo.jpg and you uploaded it in the folder /resources/assets. Then you have to edit the line in LocalSettings.php so that it looks like this:
$wgLogo = "$wgScriptPath/resources/assets/new-logo.jpg";
Don't forget when you type the name of the file to include the file extension type (e.g. .jpg).
The LocalSettings.php file that you have to edit is in the root MediaWiki folder. HostKnox customers can edit it with the File manager of the Pixie control panel. Another way of doing it is to download the file on your local computer, edit it with a text editor (e.g. Notepad) and upload it back overwriting the old file.
Note that for better results and in order to have the logo displayed on the frontend of the site the way you want it, you should resize and/or crop the image to the dimensions used by the skin before you upload the image. If the image is bigger, for example, it will be automatically resized when shown on the frontend. The exact size may vary according to the skin. The default logo that's used with the Vector skin that comes prepackaged with MediaWiki, for instance, has the dimensions 135 x 135 pixels.
For information on how to change the favicon read the article on how to set and change the favicon in MediaWiki.
Was this answer helpful?
- MediaWiki Installation Instructions
- How to remove from the footer the information about the last modification and view count of pages in MediaWiki
- How to disable password resets in MediaWiki
- How to remove the meta (footer) links in MediaWiki
- How to enable password resets based on the username or email address of users in MediaWiki