FANDOM


Forums: Index General Discussion Listing Unused Redirects
Fandom's forums are a place for the community to help other members.
To contact staff directly or to report bugs, please use Special:Contact.

50px-Replacement filing cabinet.svg

Note: This topic has been unedited for 2964 days. It is considered archived - the discussion is over. Do not add to unless it really needs a response.

Wikia has Unused categories, Unused photos and Unused templates. What would it take to get an Unused redirects entry? I'm in the process of making a lot of changes to files on my wiki (somewhere around 2,000 of them) and a while back, a bot moved most of them from .PNG to .png while also editing the articles to remove the redirects. As a result, a lot of the files have unused redirects and I can't get rid of them all unless I go into the files' links individually. An Unused redirects listing would be very helpful. --Kevin W.Talk to me 19:22, September 13, 2012 (UTC)

That's a good idea.
I think there may be a way to do such a thing using the DPL (Dynamic Page List) extension, I'll see if I can figure something out and get back to you. -452 21:42, September 13, 2012 (UTC)
If you do, I would be eternally grateful. --Kevin W.Talk to me 21:51, September 13, 2012 (UTC)
I found an example for unused files, and converted it for listing redirects.
On a page named Template:UnusedRedirects, put this code, You can change the name, but you have to change where it says "UnusedRedirects" below, as the template calls itself. The section between the "<noinclude>" tags can go on any page, but I figure everything on the one page is easiest.
After saving the page, add ?action=purge to the end of the URL to make sure the template is updated properly.
The result of this is a sortable table of all File redirects, with the redirect listed first, then the number of links to that redirect
You can change " |namespace=File" to " |namespace=Main" if you want to check normal redirects.
 <includeonly>{{#dpl:
 |linksto = {{{1}}}
 |mode=userformat
 |noresultsheader=\n{{!}}-\n{{!}}[{{fullurl:{{{1}}}}}?redirect=no {{{1}}}]\n{{!}} None
 |resultsheader=\n{{!}}-\n{{!}}[{{fullurl:{{{1}}}}}?redirect=no {{{1}}}]\n{{!}} %TOTALPAGES%
 }}</includeonly>
 <noinclude>
 {| class="wikitable sortable" style="width:100%;padding:0px !important;margin:0px !important;"
 |-
 !Redirect
 !Links
 |-
 {{#dpl:
 |namespace=File
 |redirects = only
 |format=,²{UnusedRedirects¦%PAGE%}²,
 }}
 |}</noinclude>

 
Let me know if you have any trouble :) -452 22:24, September 13, 2012 (UTC)
Oh, I should probably add that just because there are no links on the wiki, external sites may use the old redirects - but for files redirects it should be fine. -452 22:26, September 13, 2012 (UTC)
Another thing i forgot to mention is that I used external links rather than internal links as an internal link would increase the count to 1. Not really a problem, since anything with a "1" means "no other links" -452 00:27, September 14, 2012 (UTC)
I've updated the code to work a little better. With this new way, if you want to just list the redirects with no links (your original request), replace the "resultsheader" line with |resultsheader= \n{{!}}-, but I'll leave the example with all redirects, as others may still be interested in listing all redirects by usage  :) -452 00:39, September 14, 2012 (UTC)
PS. The DPL extension is not enabled by default, and you may have to request it be enabled on your wiki via Special:Contact. -452 01:08, September 14, 2012 (UTC)

Ok, it's working just fine, but I have one request - is there any way it could link to the ?redirect=no pages instead of actually going through the redirects to the files they're redirecting to? --Kevin W.Talk to me 01:26, September 14, 2012 (UTC)

Ah, of course! I've updated the above code. -452 00:08, September 15, 2012 (UTC)
Community content is available under CC-BY-SA unless otherwise noted.