A brand-new MediaWiki instance comes with a default sidebar. In MediaWiki 1.41, that sidebar looks something like this:
* navigation
** mainpage|mainpage-description
** recentchanges-url|recentchanges
** randompage-url|randompage
** helppage|help-mediawiki
* SEARCH
* TOOLBOX
* LANGUAGES
Here’s how it looks rendered:1
And if you have interface admin rights, you can edit it at MediaWiki:Sidebar.
This is great and I encourage you to edit your sidebar as one of the first things you do in your new wiki! But please, please, please, leave the text recentchanges
there.
How recentchanges works
Every display string (on the right-hand-side of the |
) at MediaWiki:Sidebar is secretly a system message. So you can edit MediaWiki:recentchanges to change the display text for the recentchanges-url
link, MediaWiki:mainpage-description for the mainpage
link, etc.
Using these built-in links comes with some advantages:
- Translations will work (for example, MediaWiki:Recentchanges/pl shows the text “Ostatnie zmiany” for Polish, etc)
- The hotkey Alt+Shift+R will work
You can tell if the hotkey is working either by pressing it or hovering the link:
How to customize your recentchanges text
Some wikis want to print Recent Changes
instead of Recent changes
, Main Page
instead of Main page
, etc (i.e. they want Title Case instead of Sentence case). This is totally fine!
But do NOT write ** recentchanges-url|Recent Changes
in your Sidebar message. Instead, navigate to MediaWiki:recentchanges
and edit the display text there to say Recent Changes
.2
If you do this wrong then:
- Translation of the interface to other languages won’t work
- Alt+Shift+R will stop working as a hotkey
But if you do this right then you’ll customize only the English UI, and the hotkey will be preserved!
EVERY string at MediaWiki:Sidebar is a message
Let’s say we want to make all our text lowercase. So we’re going to write this:
* navigation
** mainpage|mainpage-description
** recentchanges-url|recent changes <!-- incorrectly writing out the text `recent changes` -->
** randompage-url|randompage
** helppage|help-mediawiki
But then we can go to MediaWiki:recent_changes
and edit it:
And yep, the sidebar will reflect our change:
You can use your own messages!
If you want to support multiple languages with your interface text, you can absolutely create and edit your own interface messages in your sidebar! For example, you could write:
sidebar-gameinfo
* Items|sidebar-items
* Spells|sidebar-spells
Then you can make the following interface pages:
- In English:
MediaWiki:sidebar-gameinfo
with contentGameplay
MediaWiki:sidebar-items
with contentItems
MediaWiki:sidebar-spells
with contentSpells
- In Polish:3
MediaWiki:sidebar-gameinfo/pl
with contentRozgrywka
MediaWiki:sidebar-items/pl
with contentPrzedmioty
MediaWiki:sidebar-spells/pl
with contentZaklęcia
You can also use a system message for the link target. For example, the following is valid:
* submit-ticket-link|submit-ticket
MediaWiki:submit-ticket-link
is a link to your servicedesk portalMediaWiki:submit-ticket
saysSubmit ticket
MediaWiki:submit-ticket/pl
saysWyślij zgłoszenie
3
You can then reuse the message submit-ticket-link
throughout your wiki using the {{int:}}
magic word (for example, {{int:submit-ticket-link}}
). Then, if you start using a different portal, you can change the link in one single location and affect your entire wiki.
Addendum: using text-transform
Note: This is not recommended if your wiki is used by multilingual users, as English is pretty much the only language to use Title Case in titles.
There’s a cool CSS property called text-transform.4 It’s most often used when you want all-caps titles or headings with the value text-transform:uppercase;
but it also has a value called capitalize
that transforms text to Forced Title Case.
This is not by any means a perfect solution for all situations because there will probably be some words you want lowercased (e.g. Submit a Ticket
not Submit A Ticket
), and the set of words you want lowercased depends on your style guide (e.g. there is debate about whether you capitalize the word “about”).5 It gets pretty complicated, too, as the capitalization rule may depend not only on your particular style guide but also:
- Its position in the title (e.g. you always capitalize the first word)
- Its part of speech (e.g. “about” can be an adverb, adjective, or preposition)
- Whether it’s part of a proper noun (e.g. in the title “On Skylock’s Role in The Merchant of Venice”, you capitalize the “The” that is part of the play’s name, even though normally in this case “the” would be lowercased)6
Some title-case converters exist, but they will often make mistakes because they don’t understand context, and you still need to specify a style guide.
Needless to say, CSS is not capable of correctly converting to title case. But it can do capitalize
, which just capitalizes the first letter of every word no matter what, and since MediaWiki sidebars often have no prepositions, articles, conjunctions, or other parts of speech that get lowercased (sometimes), you will likely be fine applying this rule to your entire sidebar:
|
|
Conclusion
Please make sure the text * recentchanges-url|recentchanges
is in your sidebar somewhere or I’ll be really sad.
-
Note, Cargo’s “Page values” link is called “Cargo data” in the most recent version of Cargo. ↩︎
-
I wanted to say something accurate about how Fandom wikis handle this because I know their setup is different, but it turns out that their default navigation doesn’t make use of system messages for anything, let alone to include a recent changes link. I do not recommend that approach. ↩︎
-
Thanks to Elm from Palia Wiki for pointing out to me that
text-transform
was worth mentioning here ↩︎ -
At a previous job, I was in charge of picking a style manual and I picked Chicago for the specific reason that they lowercase “about” when it’s a preposition. I do not like capitalizing prepositions in titles no matter how long the word is. ↩︎
-
And now you know why my blog uses Sentence casing for all my article titles 🙂 ↩︎