MediaWiki/Theming
You can change the look and layout of your Mediawiki site. The place to start is the wikimedia groups' meta pages.
There is the design document and the info on skins or just dive into all the examples of user styles
Contents
- 1 How to change the Logo
- 2 How to change the favicon
- 3 Styling
- 4 Icons and Graphics
- 5 How to use Templates for information design, consistency, and utility
- 6 How to change the navigation
- 7 How to make your own skin
- 8 Making your Skin Available
- 9 Offering/Using multiple skins
- 10 Nice Examples
- 11 Resources
How to change the Logo[edit | edit source]
You can change the Logo of the wiki by altering the $wgLogo variable in LocalSettings.php to the name of the image you want to use as a logo. Please note that this logo should be placed in the /skins/common/images/ folder.
$wgLogo = "$wgStylePath/common/images/freephile_sm_logo.gif";
How to change the favicon[edit | edit source]
You can change the icon that is displayed in the address bar of your browser by setting a value for $wgFavicon in the LocalSettings.php file
$wgFavicon = "http://www.freephile.com/images/logos/favicon.ico";
Styling[edit | edit source]
A user can completely affect the styling of the wiki they are using by applying user-defined styling to the site. meta:Help:User_style
Icons and Graphics[edit | edit source]
For aspiring artists who want to create icons, see the Icon Guide on KDE.org
If you know the ropes of creating good graphics, see the Nuvola2 project, which appears to be an effort in the mediawiki community to bring a whole set of scalable graphics to the project.
- http://commons.wikimedia.org/wiki/Nuvola_icons_for_KDE_3.x
- http://commons.wikimedia.org/wiki/Commons:Project_Nuvola_2.0%2B
If you just want to have a bunch of good graphics available for use in your wiki, then there are image administration tools that you can use to batch import collections of graphics. Mediawiki can now handle Scalable Vector Graphics (SVG) so with a little configuration, you can import a group of SVGs and use that as a basis for your theme.
In this wiki, I imported the Oxygen graphics (see below). Importing is handled by a 'maintenance' script. See details about how image assets are managed at mw:Manual:Image_Administration
As for complete icon sets, there are a few well-known sets in the Free Software community.
- Crystal
- The KDE crystal set is nice, and you can find out more at Everaldo's website.
- Oxygen
- The standard icon theme for KDE4 You can also get scalable vector graphics from the oxygen set. If you , you should find them on your system in /usr/lib/kde4/share/icons/oxygen/ Note that you need an application (like Konqueror, Dolphin, Gwenview or Inkscape - but not Gqview) that can display SVG to view the svgz files. http://www.oxygen-icons.org/
sudo apt-get install kde-icons-oxygen
- Tango
- http://tango.freedesktop.org/Tango_Desktop_Project
Once you have all these graphics at your disposal, you'll probably want to use some of them as interface elements, rather than just as decoration / illustration of your articles. In that case, you'll want to use something like the Icon extension.
How to use Templates for information design, consistency, and utility[edit | edit source]
The template system allows you to create re-usable interface elements such as 'sidebars', 'callouts' or 'info boxes' and almost limitless utility. The Ambox template is an example of a template that you'll probably want to use in your local wiki system.
[edit | edit source]
The navigation system is setup through a special type called an 'interface message'. (The interface message system is also used for many other aspects of the Mediawiki system.) This means that you don't actually have to change 'code' to affect the menu. You can simply edit a special page in the mediawiki system. Edits to this page get stored in the database like every other page edit which provides built-in versioning etc. However, it can also mean that pushing changes from a development machine to a server can be more challenging than pushing 'code' changes.
In any case, to change the nav, you will want to edit the MediaWiki:Sidebar page. (e.g.
http://example.com/wiki/index.php/MediaWiki:Sidebar ) The right to edit this page is normally restricted to administrators, so if you want to delegate the responsibility for this, you will want to look at the user permissions system. There are rules and conventions which apply here, and you can find more help in the documentation. In case you are going to change the location of blocks like the search box or toolbox (which normally show up in the sidebar) by making a custom theme, you'll want to coordinate those changes with the sidebar.
How to make your own skin[edit | edit source]
A skin generally has it's own directory, plus two setup files. If you wanted to create a skin called 'Happy' you would have
happy Happy.php Happy.deps.php
in the 'skins' directory.
The easiest way to create your skin is to copy the monobook skin and start from there.
You can create a skin all by yourself by following the steps provided below:
- Go to your mediawiki 'skins' directory;
- Copy the monobook directory and name it with the name of your skin: happy;
- Copy the MonoBook.php file and name it with the name of your skin: Happy.php;
- Edit Happy.php and change the class name to SkinHappy:
class SkinHappy extends SkinTemplate;
- In Happy.php, change the template class to have your skin name together with the word 'Template':
class HappyTemplate extends QuickTemplate;
- Also in Happy.php, make the references to the skin match the names:
$this->skinname = 'happy'; // matches the physical directory name
$this->stylename = 'happy'; // matches the physical directory name
$this->template = 'HappyTemplate'; // matches the template class name
- In your happy directory edit the image and CSS files until your heart is content;
- Edit and customise Happy.php as you please;
Making your Skin Available[edit | edit source]
To make your skin available sitewide, and the default skin, set it in LocalSettings.php e.g. set $wgDefaultSkin = 'happy'.
To let your users decide which skin they can use, you can enable user preferences.
Offering/Using multiple skins[edit | edit source]
If you have multiple skins available, you can preview and switch between them by visiting your user preferences. Since a given skin can be specified in the querystring, you can even bookmark a certain 'look' for easy comparison with a new theme. e.g. http://freephile.com/wiki/index.php?title=Main_Page&useskin=monobook
Nice Examples[edit | edit source]
The skin used on this site is based on the excellent work of Paul Gu Developers should check out Wiki developers for more sites of people like Paul who develop wikis.
There are countless examples of mediawiki installations across the Internet. Some of the ones that have actually bothered to customize the "look and feel" include
- the Linux Foundation site is powered by Mediawiki, but rumor is that they are moving more content to drupal.
- the KDE Techbase is Mediawiki. The http://techbase.kde.org/Development/Software_Engineering_Framework article explains all their tech platform tools.
- The Tango project (see "icons" above) runs their website on a customized MediaWiki.
- The Blender project has a nice custom skin
- The Eclipse project uses MediaWiki for their wiki site
- Amarok rocks with MediaWiki
- Creative Commons
- Fedora Project wiki
I've seen some other projects that have nice Mediawiki skins, but I never bothered to write them down. A quick search reveals several projects by Suse:
- http://en.opensuse.org/Welcome_to_openSUSE.org
- http://www.mono-project.com/Main_Page
- http://beagle-project.org/Main_Page
- http://en.opensuse.org/Welcome_to_openSUSE.org
I hesitate to call it a 'nice example' because it doesn't seem all that compelling, but there is the mozilla project wiki https://wiki.mozilla.org/Main_Page http://developer.mozilla.org used to run Mediawiki, with a very nice theme and lots of custom templates and graphics. Now they are running a commercial opensource wiki product called "deki" which is apparently trying to compete in the "enterprise wiki" market.
Resources[edit | edit source]
The skinning manual http://www.mediawiki.org/wiki/Manual:Skinning is probably the most comprehensive and best introduction to how the skin system works aside from digging into the code in the 'skins' directory.
http://www.softwarekombinat.de/wiki/Customize_mediawiki has one of the best 'howto's that I found.
The Layout Design Document might cover some relevant info, but a quick glance makes it seem that it's circa 2004.