Special:WhatLinksHere should canonicalize namespace aliases given in URL


The namespace parameter for Special:WhatLinksHere only accepts a numeric index:


It should also accept a namespace alias. At present a non-numeric value is ignored:


This would facilitate the development of utility templates.

Version: unspecified
Severity: enhancement

bzimport added a project: MediaWiki-Special-pages.Via ConduitNov 22 2014, 2:56 AM
bzimport added a subscriber: wikibugs-l.
bzimport set Reference to bz62988.
Scott created this task.Via LegacyMar 23 2014, 8:13 PM
MZMcBride added a comment.Via ConduitMar 23 2014, 11:25 PM

(In reply to Scott Martin from comment #0)

This would facilitate the development of utility templates.

Can you provide a specific example? Off-hand I'd think that the namespace ID would be better for use in a template (a programmatic context). The namespace name as a URL parameter requires encoding/quoting if there's anything remotely silly in it; for example, the space in "&namespace=Project talk" would need to be changed to a "_" or "%20" or something, while "&namespace=5" is perfectly fine.

I don't imagine this request is particularly difficult to implement, but I'm still personally unsure the additional code complexity is warranted.

Scott added a comment.Via ConduitMar 24 2014, 12:15 AM

Sure; there's already a {{What links here}} on enwp, which is just a wrapper for [[Special:WhatLinksHere/Page name]]. You can't pass a namespace to it.

An upgraded version would instead generate a link to a fully specified URL. As you note, the parameter name would need to be passed through {{urlencode:}} on the template side.

Okay, all that said, I've just been informed that there is a hacky way to get a namespace index from its alias, by giving a fake page name to {{NAMESPACENUMBER}} - {{NAMESPACENUMBER:Namespace you're interested in:X}}. And I'm going to use that technique right now. So I guess this request is moot and I don't mind it being WONTFIXED on that basis - although I think it would be cool to have a non-hacky way to use a namespace alias directly.

Scott added a comment.Via ConduitMar 30 2014, 3:12 AM

WONTFIXing as bug 35486 makes this unnecessary - Special:WhatLinksHere is becoming embeddable and will take a namespace parameter.

Bawolff added a comment.Via ConduitMar 30 2014, 3:15 AM

I should note the parameter will still be numeric only.

Scott added a comment.Via ConduitMar 30 2014, 3:31 AM

Oh, right. What I meant by that question on the other bug was specifically would it take a text parameter as suggested in the bug filing.

As the workaround I mentioned above exists, I'll reopen this as a lowest priority enhancement without prejudice against a re-WONTFIX from anyone who knows better.

Add Comment

Column Prototype
This is a very early prototype of a persistent column. It is not expected to work yet, and leaving it open will activate other new features which will break things. Press "\" (backslash) on your keyboard to close it now.