User:Mike Dillon/Sidebar
Variations of MediaWiki:Sidebar
Problems
[edit]Tool tip and access key for "Main page" are missing in navigation box (works on logo)- Lower-case name for "interaction" box when "text-transform: none" is set in user CSS
"Contents","Featured content","About Wikipedia", and "Contact us"are missing tooltipsUse of periods in default tooltips is inconsistent (possibly bugzilla)
How the sidebar works
[edit]This is how the sidebar works (at least for the Monobook skin):
- Parse MediaWiki:Sidebar
- Lines starting with "* " indicate portlet headings
- Lines starting with "** " indicate portlet entries; the link target and link label are separated by "|"
- Resolve link targets and link labels
- Look for target and label as system messages in the "MediaWiki" namespace
- If there is no message with that name for either the link target or the link label, use the text as is
- Render the portlets
- The header is rendered with a XHTML id of "p-$HEADERNAME"
- The value of the message key for the link label ($LABEL) of each line is converted into a CSS class by normalizing spaces to hyphens and prefixing "n-" (e.g. "n-currentevents")
- The value of $LABEL is used to find the tooltip and access key
- Access Key: MediaWiki:Accesskey-n-$LABEL (e.g. MediaWiki:Accesskey-n-currentevents)
- Tooltip: MediaWiki:Tooltip-n-$LABEL (e.g. MediaWiki:Tooltip-n-currentevents)
For the built-in defaults, things like MediaWiki:Tooltip-n-currentevents have a system supplied value, which is why they often appear as redlinks. This means that the messages have not been customized on-wiki. The naming scheme for access keys and tooltips is extensible, so any new message added can use these system messages to get these values; in the case of new messages like "aboutwikipedia" (see below), this is required to get tooltips or access keys without using JavaScript.
There are some other wrinkles related to alternate user interface languages using the "uselang" parameter, but they're not particularly relevant.
Hopefully this shows why keeping the message keys the same is important; it allows consistent CSS/XHTML ids to be used for scripting and styling despite changes to the user interface messaging.
Caveats
[edit]- The MediaWiki:Mainpage message is also used to create the link for the logo... It cannot be changed without making the site's home page turn into a redirect. This could be fixed by making MediaWiki use MediaWiki:Mainpage-url for the logo link, or by using something like MediaWiki:Mainpage-label for the label and copying over all of the localizations of the existing MediaWiki:Mainpage system message. The first approach is probably better. Another option would be to actually move the location of Main Page to match the value of MediaWiki:Mainpage.
Benefits of using keys for labels
[edit]Changing the sidebar to use fixed key names instead of inline labels has the following benefits:
- Ability to have MediaWiki render tooltips and access keys into HTML source instead of having to use JavaScript
- Stability of XHTML ids for portlets and list items for use in scripting and custom user styles
- Ability to hook into interface internationalization seamlessly (e.g. http://en.wikipedia.org/wiki/Main_Page?uselang=es)
I believe these are the reasons why the core installation uses internal message keys for labels in the default MediaWiki installation. Modifying the sidebar as I've detailed here will regain these benefits.
Default
[edit]Source | Expanded | Display |
---|---|---|
|
|
Current (as of April 16, 2007)
[edit]Source | Expanded | Display |
---|---|---|
|
|
|
Proposed
[edit]Source | Expanded | Display |
---|---|---|
|
|
Tooltips and access keys
[edit]Implementation
[edit]Add new keys
[edit]- MediaWiki:Aboutwikipedia = About Wikipedia
- MediaWiki:Aboutwikipedia-url = Wikipedia:About
- MediaWiki:Contents = Contents
- MediaWiki:Contents-url = Wikipedia:Contents
- MediaWiki:Featured = Featured content
- MediaWiki:Featured-url = Wikipedia:Featured content
- MediaWiki:Interaction = Interaction
- MediaWiki:Mainpage-url = Main Page (Note: This update should not be made yet because it may have undesired side effects; cf. #Caveats)
Change sidebar
[edit]* navigation ** mainpage-url|mainpage ** contents-url|contents ** featuredcontent-url|featuredcontent ** currentevents-url|currentevents ** randompage-url|randompage * interaction ** aboutwikipedia-url|aboutwikipedia ** portal-url|portal ** recentchanges-url|recentchanges ** contact-url|contact ** sitesupport-url|sitesupport ** helppage|help
* navigation ** mainpage|Main page ** contents-url|contents ** featuredcontent-url|featuredcontent ** currentevents-url|currentevents ** randompage-url|randompage * interaction ** aboutwikipedia-url|aboutwikipedia ** portal-url|portal ** recentchanges-url|recentchanges ** contact-url|contact ** sitesupport-url|sitesupport ** helppage|help
Update existing keys
[edit]- MediaWiki:Mainpage = Main page (Note: This update should not be made yet because it may have undesired side effects; cf. #Caveats)
Tooltips, Access Keys (optional)
[edit]- aboutwikipedia
- contact
- contents
- featured
Internationalization
[edit]All of the keys listed above will need to have translations added to make interface localization work with the "uselang" parameter and/or user language preferences. This is done by editing the language-code specific subpage for each interface message. For instance, to localize the "Interaction" heading for Spanish, MediaWiki:Interaction/es should be set to "Interacción". If we want to lowercase the Turkish version of "Main page", MediaWiki:Mainpage/tr should be set to "Ana sayfa" (nearly all versions of "Main page" except English are already sentence case).
These localizations only need to be done for the interface messages used for labels, not the ones for URLs.
Impacted users
[edit]All of these searches were performed on April 17/18, 2007. They should be redone if/when the issues with the sidebar are dealt with.
References to n-Contents
[edit]These references will need to change from "n-Contents" to "n-contents".
- User:CBDunkerson/monobook.css
- User:Glen/monobook.css
- User:Logical2u/monobook.css
- User:Zzuuzz/monobook.css
References to n-Featured-content
[edit]- User:Shorelander/monobook.css
- User:Eugene van der Pijll/monobook.css
- User:Zzuuzz/monobook.css
- User:Bjweeks/monobook.css
- User:Slugger/monobook.css
- User:Seancdaug/monobook.css
- User:Mysid/monobook.css
- User:Glen/monobook.css
- User:Glens userspace watcher/chick.css
- User:Reverend Lee/monobook.css
- User:Ruud Koot/monobook.css
- User:Ttervo/monobook.css
- User:Z.E.R.O./monobook.css
References to n-Main-page
[edit]These references will need to change from "n-Main-page" to "n-mainpage".
- User:Dvyjones/mainpage.js
- User:Eugene van der Pijll/monobook.css
- User:Zzuuzz/monobook.css
- User:Matt B./monobook.js
- User:Reverend Lee/monobook.css
- User:Z.E.R.O./monobook.css
References to n-About-Wikipedia
[edit]- User:Adrian M. H./monobook.css
- User:Bjweeks/monobook.css
- User:Eugene van der Pijll/monobook.css
- User:Glen/monobook.css
- User:Gwern/monobook.css
- User:Logical2u/monobook.css
- User:Mysid/monobook.css
- User:Outolumo/myskin.css
- User:Prince Kassad/monobook.css
- User:Reverend Lee/monobook.css
- User:Rholton/monobook.css
- User:Slugger/monobook.css
- User:Z.E.R.O./monobook.css
- User:Zzuuzz/monobook.css
References to n-About-Wikipedia
[edit]- User:Adrian M. H./monobook.css
- User:Bjweeks/monobook.css
- User:Eugene van der Pijll/monobook.css
- User:Glen/monobook.css
- User:Gwern/monobook.css
- User:Logical2u/monobook.css
- User:Mysid/monobook.css
- User:Outolumo/myskin.css
- User:Prince Kassad/monobook.css
- User:Reverend Lee/monobook.css
- User:Rholton/monobook.css
- User:Slugger/monobook.css
- User:Z.E.R.O./monobook.css
- User:Zzuuzz/monobook.css
How to add long and complex links to MediaWiki:sidebar
[edit]- Peter Blaise says: Note: Mike, I wanted to add traditional "indexes" as links in the sidebar. I found that full-length links or "&" characters in my links caused those links to fail to show up in the sidebar display. An example goal is to show a link to "All talk pages", for instance, like this raw URL that works on it's own, but not when inserted into the sidebar:
- http://www.our-mediwiki-url.com/index.php?title=Special%3AAllpages&from=&namespace=1
- ... but that line just disappeared in the display of the sidebar, as did any iteration of the same, with or without spaces when adding a "|" pipe character after that link to describe it in the MediaWiki:sidebar, and so on. I contacted the mediawikil mailing list http://lists.wikimedia.org/mailman/listinfo/mediawiki-l. There, Alexis Moinet and Brion Vibber explored the problem and here's what seems to work for now, see MediaWiki-l Digest, Vol 45, Issue 34 at http://lists.wikimedia.org/pipermail/mediawiki-l/2007-June/021023.html. Instead of directly using long and complex links, we first created a new "MediaWiki:nnn" page that contains the long complex link for us. Then, using the shorter, simpler name of that newly created "MediaWiki:nnn" page, we could create a link that does finally work in the sidebar. When clicked, it goes directly to the target page from the sidebar as intended. Here are the steps to success:
- How to add long and complex links to MediaWiki:sidebar
- Find the intended target page and copy it's full URL address
- In the "search" box, type: MediaWiki:new-link-page-name (page-title of your choosing), [Go]
- Create/edit new page "Mediawiki:new-link-page-name"
- Paste the long complex link of the intended target page into the contents of the new page, such as the one line in our sample:
- http://www.our-mediwiki-url.com/index.php?title=Special%3AAllpages&from=&namespace=1
- Save the new page
- In the "search" box, type: MediaWiki:sidebar, [Go]
- Edit the Mediawiki:sidebar page, adding a new line at the bottom that reads:
- ** new-link-page-name|description
- Save the Mediawiki:sidebar page
- Note, find all the "MediaWiki:nnn" pages by going to "Special:Allpages" and selecting "Mediawiki" from the drop-down menu
- How to add long and complex links to MediaWiki:sidebar
- Caveats: This seems to require the long URL, such as:
- http://www.our-mediwiki-url.com/index.php?title=Special%3AAllpages&from=&namespace=1
- ... but we cannot yet figure out how to make shorter, relative links, such as:
- index.php?title=Special%3AAllpages&from=&namespace=1 or
- Special:Allpages&from=&namespace=1
- So, this solution is not portable, and must be custom created for a specific long, localized URL - dang! If anyone has a suggestion of a briefer, common way to accomplish putting such expanded "special:nnn" links into the sidebar, PLEASE let us know! I've copied this to MediaWiki.org at http://www.mediawiki.org/wiki/MediaWiki_talk:Sidebar since this is really MediaWiki content, not Wikipedia.org content.
- -- Peter Blaise Peterblaise 12:30, 13 June 2007 (UTC)