Topic on Extension talk:GlobalCssJs

Jump to navigation Jump to search

Add a link to special pages of local wikis

Superchilum (talkcontribs)

@Legoktm: Is there a possibility to add a link to special pages, which changes for every wiki? With local js I used to link to "", "" etc. How can I do now with global js? Does it exist something like "http://LOCALWIKI/wiki/Special:UnconnectedPages", so if I'm on it.quote it will link to, if I'm on en.voy it will link to etc.?

Legoktm (talkcontribs)

You can use:

var url = "https:" + mw.config.get('wgServer') + "/wiki/Special:UnconnectedPages";

And use the url variable wherever you need it.

Superchilum (talkcontribs)

@Legoktm: Thanks :-) I've modified accordingly, but no link appears... why?

Ricordisamoa (talkcontribs)

mw.util.getUrl returns a relative URL, but it should suffice for your purposes.



Using my superpower, I guessed that you enabled the "collegamenti personali" gadget on the Italian Wikipedia. Unfortunately, it doesn't work on Meta-Wiki, but you can still use the standard mw.util.addPortletLink function:

mw.util.addPortletLink( 'p-navigation', mw.util.getUrl('Special:UnconnectedPages'), 'Pagine non connesse', 'unconnected-pages' );
Superchilum (talkcontribs)

@Ricordisamoa: Thank you so much, it does work! Regarding the "collegamenti personali" gadget, do you mean I can delete the line from my global.js?

Reply to "Add a link to special pages of local wikis"