Topic on Extension talk:GlobalCssJs/Flow

Add a link to special pages of local wikis

5
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 "https://it.wikivoyage.org/wiki/Special:UnconnectedPages", "https://it.wikiquote.org/wiki/Special:UnconnectedPages" 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 https://it.wikiquote.org/wiki/Special:UnconnectedPages, if I'm on en.voy it will link to https://en.wikivoyage.org/wiki/Special:UnconnectedPages 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.

Example:

mw.util.getUrl('Special:UnconnectedPages')

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"