It's proposed that SkinMustache options are extended to allow generation of URIs
For now, it is recommended that query string parameters are not supported.
It's proposed that a skin should be able to register links to use in the Mustache template like so:
"ValidSkinNames": { "myskin": { "class": "SkinMustache", "args": [ { "name" : "myskin", "templateDirectory": "skins/MySkin/templates/", "messages": [ "mainpage" ], "links": { "mainpage": "mainpage", "create-account": "Special:CreateAccount" } } ] } }
An associate array of links will be given. The keys are mapped to link- prefixed template keys that contain the URI. When combined with the existing messages option, this can be used to generate links. In the above example, a template can render a link like so:
<a href="{{link-mainpage}}">{{msg-mainpage}}</a>
Link values will be first treated as message keys and if no message exists, will be treated as Title objects.
This will be needed to port CologneBlue to SkinMustache, as CologneBlue contains custom menus linking to the aboutpage for example.
Acceptance criteria
- It should be possible to generate a URI from a MediaWiki message
- It should be possible to generate a URI from a specified Title.
- All links generated are prefixed with link-
- All links generated are in the current content language
Developer notes
foreach ( $links as $key => $pageOrMessage ) { $msgObj = $this->msg( $pageOrMessage ); if ( $msgObj->exists() ) { $url = Skin::makeInternalOrExternalUrl( $msgObj->inContentLanguage()->text() ); } else { $url = Title::newFromText( $pageOrMessage )->getLocalURL(); } }