Modifying the MoinMoin Default Style Sheets

/!\ In 1.2, this is a bit outdated, as we have themes now. But the basics still apply...

If you wish to modify the default MoinMoin style sheet, it is a good practice to create a new .css file and use the @import function to import the original moinmoin.css file. Override only those attributes you wish to change. Then, if you later upgrade to a newer version of MoinMoin, any changes to the original moinmoin.css file will be incorporated automatically.

The following example assumes you have followed the installation instructions and created an Apache or IIS alias called wiki pointing to ~/share/moin/htdocs and another alias called wikidata pointing to ~/Moin/wikidata for holding your logos and style sheets.

To override the default body background color and font, use your text editor to create a file called mywiki.css with the contents shown below and save it in the directory ~/Moin/wikidata.

@import url("/wiki/css/moinmoin.css");

body {
    background-color: #FAEBD7;  
    font-family: Arial,Helvetica;  
}

Next, edit ~/Moin/mywiki/moin_config.py and modify (or add) the following line:

css_url = '/wikidata/mywiki.css' 

Test by accessing any wiki page and verifying your changes are correct.

Allowing Users to Choose a Style Sheet

To allow you users to choose between alternate style sheets, you first need to create several choices. Using the example above, change the background-color to #E7FFE7 and save the file as green.css in ~/Moin/wikidata/.

Test this option by modifying your user preferences to select a CSS URL of /wikidata/green.css.

Finally, you will probably need to edit HelpOnUserPreferences and change the wording for CSS URL to instruct your users on the choices available, including the new option for a green background.

Note: When a user initializes or updates their UserPreferences, the default value for CSS URL will be the value specified in ~/Moin/mywiki/moin_config.py. Changing the value in moin_config.py changes the value for all users, except for those who have explicitly specified an alternate css file. Any user can return to the default value by erasing the CSS URL field value and clicking the Save button.