I would like a tool in the sidebar's "Tools" section that takes readers to Special:PrefixIndex/FULLPAGENAME
where FULLPAGENAME
is replaced with the current page's full name. For example, say I was on the page Module:Citation/CS1
then I would like a tool in the sidebar called Subpages
that takes me to Special:PrefixIndex/Module:Citation/CS1
. I have seen (the mediawiki sidebar manual) and I added:
function CustomizeModificationsOfSidebar() {
// Adds PrefixIndex
var page = mw.config.get( 'wgPageName' );
ModifySidebar( 'add', 'toolbox', 'Subpages', "http://127.0.0.1/mediawiki/index.php/Special:PrefixIndex/"'page' );
}
jQuery( CustomizeModificationsOfSidebar );
to the page MediaWiki:Common.js
. This gave the JavaScript error: Error: Expected ')' and instead saw 'page'.
that prevented me from saving the page.
Your script is missing a comma, it should be
Of course, you will have to add the actual
ModifySidebar
function to.Alternative approach: Though not recommended in the manual, you can actually use magic words, such as
{{FULLPAGENAME}}
inMediaWiki:Sidebar
, so adding something like this should work:You might run in to caching troubles, though. Make sure
$wgEnableSidebarCache
is off inLocalSettings.php
(it is by default)Edit: The comment from Tgr below is also very relevant: This will have performance implications