Template talk:Category redirect


Who made this so freaking ugly!!!! :/ please prettify again. pfctdayelise (translate?) 03:03, 29 June 2006 (UTC)

Pfctdayelise and I agreed that the color scheme using the pumpkin color was garish and unprofessional. In its present format (border blue, background color light blue (background-color:#e0e0ff), and header color darker blue (#ccccff), the warning is impossible to ignore, but not due to tastelessness. -Mak 08:16, 7 August 2006 (UTC)

When to use?Edit

I am totally confused by the usage note, which seems to require intimate knowledge of Wikipedia. What is the recommended way to tag a category that you don't want populated? --InfantGorilla 18:24, 26 October 2006 (UTC)

This is fine. pfctdayelise (说什么?) 13:52, 29 October 2006 (UTC)


Why can't you make just a simple redirect and have the bots move the pictures? --Botev 08:32, 30 April 2007 (UTC)

Because if it's a simple redirect, people will keep putting stuff in the wrong cat, and you (ideally) don't want the bots to constantly have to work on this. Superm401 21:00, 10 December 2007 (UTC)
Actually, I fail to see why the tag {{category redirect}} should be more efficient in preventing people from putting the stuff into the wrong category than the #redirect command is. Both clearly indicate that one category name is preferred and should be used while the other isn't preferred and should be avoided. --Botev 22:08, 10 December 2007 (UTC)
Either the cats should be read only or there should be a bot which changes the cats in the meda from time to time. There must be a solution, the situation now is more than unhappy.--Avron 07:54, 3 March 2008 (UTC)
Well, {{Category redirect}} does have the advantage of standing out more to the user. But mainly, I think the software should handle plain category #redirects better. Superm401 - Talk 10:22, 13 April 2008 (UTC)
I totally oppose to this "solution", it makes life at Wikimedia Commons harder. In Germany we call that "Warum einfach, wenn es auch kompliziert geht?" —→ #redirect category... is much easier and it saves that extra click (if you're working with categories the whole day, it get's annoying). I'm wondering if all that Bots do that right. Do they act upon any convention referring to this topic? --Mattes (talk) 06:06, 7 October 2008 (UTC)
People tend not to notice the little "Redirected from..." in the corner, which means they keep putting things in the wrong category. Superm401 - Talk 01:40, 11 October 2008 (UTC)

Link to Template:Bad name?Edit

Hello, why this template links to template Template:Bad name? It is intended for files only, isn't it? --Martin Kozák 23:29, 25 May 2007 (UTC)

This has been changed to point to Template:Duplicate. However, this template isn't intended for cats either. Superm401 - Talk 10:22, 13 April 2008 (UTC)
I'm planning to make a {{bad cat name}} tailored towards badly named cats no one else is likely to use. It will read something like:
This category has an incorrect name, which is unlikely to be used in the future. The correct category is Category:newname. All items in this category should be recategorized in Category:newname, then this category should be deleted.
Superm401 - Talk 08:51, 17 April 2008 (UTC)
I think, you misinterpreted "Category redirect" - main intention was, to redirect local-interwiki habits to our commons habits: it is to tell where a specific category is to find here, not that its got a "bad name" (as missing plular form) but that there is no sense to "duplicate" categories under different names --W!B: 09:26, 18 April 2008 (UTC)
I know {{Category redirect}} isn't for "bad names". However, the template currently says, "misspellings unlikely to be used by other people" should have {{duplicate}}. But Template:duplicate is meant for images, not cats. I'm proposing we make Template:bad cat name, and mention it here in place of duplicate. Superm401 - Talk 17:36, 20 April 2008 (UTC)
ah I understand, You're right, but woudn't it be easier to adjust Template:duplicate to fit on *all media* (not only images, but sounds, ..) including cats - as we do not separate deleting media and categories, there is no use separating deletion tags (see Commons:Deletion guidelines#Categories
Category redirect is different, because it implies expicitely to keep that name of a cat, but not to fill it with contents.. a case not appearing with media-files.. --W!B: 20:11, 21 April 2008 (UTC)
I think creating a new template is better in this case. That way, there's a perfect fit for the situation. I've mentioned this discussion at Template_talk:Duplicate#Template:Duplicate_and_redundant_categories. Superm401 - Talk 22:26, 24 April 2008 (UTC)

Extra colon in link to category when bad name should be usedEdit

Hi, Could an admin correct {{bad name|:Category:correct category name}} into {{bad name|Category:correct category name}} Thank you, -- Slaunger (talk) 20:49, 29 July 2008 (UTC)

  Done Thanks. Rocket000 (talk) 23:14, 5 August 2008 (UTC)



This is a very helpful template.

Part of its wording reads "This tag should be used on existing categories that are likely to be used by other editors, even though the "real" category is elsewhere.". That wording implies to me "...used and left on existing categories...".

If that is correct then the wording should be amended to more precisely reflect the intent.

It is certainly true that in many cases it is advantageous to keep empty redirects with this template in them as they can often:

  1. be an aid to finding the correct category for a file
  2. provide a warning that an apparently "obvious" category is not in fact the correct (consensus) one.

-Arb. (talk) 17:02, 21 August 2008 (UTC)

As you can see in the discussion on User_talk:Rocket000#.7B.7Bcategory_redirect.7D.7D, some folks find redirects evil and they are indeed a nightmare in terms of system management, learn bad habits to the users and give sometimes wrong information to the users. I plan to user a wider debate on the problematic within a couple of days. --Foroa (talk) 17:37, 21 August 2008 (UTC)--Foroa (talk) 17:37, 21 August 2008 (UTC)

New ideaEdit

There's some recent talk about cleaning up empty categories. These have been piling up thanks to this template. Well, soft category redirects in general (and disambig cats). They make Special:UnusedCategories kinda useless. I was thinking of ways to make the software not think these are empty like it does for real redirects. At first i thought of simply adding a random page to every redirected category. Easy to do (just paste a list of categories on some page), but that wouldn't be pretty. I thought of a way to "trick" the software into thinking they were hard redirects (the pages would start with #REDIRECT but intentionally be broken and hidden with CSS) but that's also messy and would ruin our other lists. So here's my idea: let's have this template categorize the categories in themselves. It makes them no longer empty and doesn't interfere with the real categories. To keep them being considered empty to us, we would make the template check for {{PAGESINCAT}} > 1 instead of {{PAGESINCAT}} != 0. Should we try it? Rocket000(talk) 23:42, 4 September 2008 (UTC)

It would be better to change Special:UnusedCategories not to count categories that are in Category:Category redirects, but this is a decent interim solution. Superm401 - Talk 04:48, 5 September 2008 (UTC)
Of course, that would be ideal but I doubt that will happen since there would have to be a change in the MediaWiki software itself and Category:Category redirects is just a normal user-created category. If there was a software solution, it would most likely a magic word or something we add to any page to have it stay out of the relevant maintenance report(s). Rocket000(talk) 08:54, 5 September 2008 (UTC)

Change of 17 04 2009Edit

When looking in Category:Glacier, the latest change did not bring much relief. --Foroa (talk) 06:28, 17 April 2009 (UTC)

It wasn't intended to fix that not empty bug. It was to clear the unused category report. Rocket000 (talk) 06:47, 17 April 2009 (UTC)
Your test with glacier failed because Hotcat dynamically changed the redirected cat. I just did a test, and one has to add & remove an item to the redirected cat and then perform a dummy edit (dummy edits are not realy necessary: the redirect bots seem to do that every night or so). In terms of unused cats, you'll have to look for a solution for unidentified objects that should remain, as empty as possible. --Foroa (talk) 06:59, 17 April 2009 (UTC)
Yeah, I forgot about that, but I removed the template while I did it the second time. What do you mean "for unidentified objects that should remain, as empty as possible"? Rocket000 (talk) 07:08, 17 April 2009 (UTC)
The standard naming of categories for unidentified people, plants, ... is "unidentified ..." Category:Unidentified subjects. Those hundreds of categories should be remain as empty as possible, so please no deletion because it is empty.
This User:RussBot/category_redirect_log will not like the newer version and needs two hours more time to do its daily job. (and the recursive cat is quite confusing) --Foroa (talk) 12:12, 17 April 2009 (UTC)
Yes I know about the naming convention but I still don't see why that has anything to do with what I did. They "should remain, as empty as possible". So should any other category redirect. What makes those special? Anyway, I changed the template from checking {{PAGESINCAT}}≠0 to {{PAGESINCAT}}>1 to determine if it's empty. If templates can do it, bots can certainly be programed to do it. It may be confusing at first, but these are redirects, the normal user shouldn't see them that much. Rocket000 (talk) 20:35, 17 April 2009 (UTC)
Ok, I'm planning on undoing it as soon as we get the next update to Special:UnusedCategories because it is a ugly hack. Rocket000 (talk) 20:53, 17 April 2009 (UTC)
And that didn't even give us a full list. Why do we have so many empty categories? Rocket000 (talk) 08:53, 19 April 2009 (UTC)
Personally, I have no problems with empty categories anymore because people see now when they are empty and tend to speedy them if they are really useless. I prefer to have "professionally" made empty categories than categories that are created on a as needed base but without all the right links to other categories. Further tests with glaciers show that if the counts shows 1F, you have to add and remove an image before the problem go away: adding and removing something else don't seem to reset the counter. --Foroa (talk) 17:34, 20 April 2009 (UTC)
That is weird. I wonder why it only work for images? I agree not all (or most) empty categories should be deleted, but there are tons that should be (the non-professionally made ones, ones unlikely to ever be used). I tend to keep any that are part of a larger category system such as species or places (especially if they have some template like on Category:History of Saint Martin (France)). These are likely to eventually be used; they are just waiting for images. Rocket000 (talk) 17:48, 20 April 2009 (UTC)
Further tests show that a corrupted category counter (in my test cases the image counter) is only corrected when the category is displayed AND the display contains one or more images (I guess the same would be true for galleries and categories but I have no test case). When no display is activated when images (or other stuff) are getting in and out the category, the counter is not corrected. --Foroa (talk) 05:57, 21 April 2009 (UTC)


I would like to discuss the addition of __NOINDEX__ to this template. I believe that this should help our own search engines to not show the categories as a prime search result. -- billinghurst (talk) 01:05, 26 September 2009 (UTC)

Why? That's one of the main reasons we have these redirects—so people can find the right category when they search for an alternate term. Unlike Wikipedia, our categories are sometimes just as important or even more important than our so-called mainspace. Rocket000 (talk) 03:20, 26 September 2009 (UTC)
Hmm, though some should not be seen by a search engine, especially some of the plurals, eg. Maltese Cross search. Maybe there can be an extra piped option to NOINDEX specific cases. -- billinghurst (talk) 04:28, 26 September 2009 (UTC)
You're right. Anything the search engine can account for (such as singular vs. plural) shouldn't show up. I was thinking more of things like this. NOINDEX only affects external searches like Google. MediaWiki's will always work the same (which is a good thing if you think about it, something needs to search everything). Rocket000 (talk) 05:22, 26 September 2009 (UTC)
So it would be possible to have an additional piped option |noindex  ? -- billinghurst (talk) 05:50, 26 September 2009 (UTC)
Well, I'm of the opinion that Google was meant to search the whole Internet, so let it. I just don't see the benefit. More information can't hurt, but less can. Besides, that a lot of work anyway. Why not manually add __NOINDEX__ to the pages? Rocket000 (talk) 10:35, 26 September 2009 (UTC)

Useless category redirects should be deleted. All others should be indexed. -- User:Docu at 10:44, 26 September 2009 (UTC)

Problems with apostrophe ?Edit

Category:L'Art de Vivre and Category:L'Impressionniste show always empty. --Foroa (talk) 12:41, 20 November 2009 (UTC)

Temporary glitch? Seems to be working fine. Rocket000 (talk) 04:44, 3 December 2009 (UTC)
I've put back an image in Category:L'Impressionniste. There must be something wrong with the aphostrophe but I think that Russbott will detect it. --Foroa (talk) 07:46, 3 December 2009 (UTC)
Hmm, I'll investigate. Rocket000 (talk) 09:48, 3 December 2009 (UTC)
It's because the page name is appearing as L'Impressionniste to the {{PAGESINCAT:}}. I have no idea why. Rocket000 (talk) 10:01, 3 December 2009 (UTC)

Protected edit requestEdit

Lietuvių: editprotected

Please undo this edit to Template:Category_redirect/en, per Administrators' noticeboard/User problems#Foroa. -- User:Docu at 23:16, 14 December 2009 (UTC)

  Not done . The change was correct. Multichill (talk) 15:18, 1 January 2010 (UTC)


Why isn't this template working anymore? It's not redirecting to anywheres else. See it's related links. Mizunoryu 大熊猫❤小熊猫 (talk) 14:25, 5 May 2010 (UTC)

Categorizing of non-empty redirectsEdit

{{editprotected}} I propose to categorize non-empty redirects automatically under the goal category. Reason: when some un-emptied category is labelled as "seecat" or when somebody insert some file into redirected category, such files needlessly become unavailable for many days (often for weeks) and disappear from the category structure.

I propose to replace

[[Category:Non-empty category redirects]]


[[Category:Non-empty category redirects]] [[Category:{{{1}}}|~]]

in order to categorize non-empty redirect just for the time when it is non-empty. (However, an effect will be weeks delayed because of permanent job queue crowding.)--ŠJů (talk) 14:40, 7 October 2010 (UTC)

Sounds good.  Docu  at 17:04, 7 October 2010 (UTC)
  Done --Mormegil (talk) 09:12, 10 October 2010 (UTC)
Cool feature, but could you replace [[Category:{{{1}}}|~]] by [[Category:{{{1}}}|~{{PAGENAME}}]] ?
Because the current ordering does not respect the category name.
Cheers Liné1 (talk) 15:04, 5 November 2010 (UTC)

Categorization of non-empty category redirect failsEdit


Due a bug, categorizing into Category:Non-empty category redirects is not updated properly and files or subcategories from redirects is not moved the new categories by bot. See Commons:Village pump#Categorization by variables in the template. As long as this bug will be not resolved, it's needed to make an empty (pretended) edit of this template periodically to induce automatic review (updating) of categorization. --ŠJů (talk) 20:23, 20 April 2012 (UTC)

No fundamental problem, I dummy edit (only edit + save, no need to change anything) this template once or twice a day. --Foroa (talk) 15:44, 21 April 2012 (UTC)
  Not done There is nothing wrong with the template (or, rather, there is no edit to the template which would resolve the stated issue). --Mormegil (talk) 10:28, 24 May 2012 (UTC)

Categorization allowed ?Edit

Hello. Do redirected categories allow categorizations ? See Category:Escaut and history of June 3rd and 4th 2011 (Escaut is the French name of Category:Scheldt and should appear in Category:Rivers of France by name as is). Any other solution would be not satisfying (e.g. creating an empty category, just because of the name; and Scheldt is Escaut). Jack ma (talk) 09:08, 1 June 2012 (UTC)

In the {{Category redirect}} template, it is mentioned: "Redirected categories should be empty and not categorised themselves." In Commons:Rename a category as well. This is an unfortunate consequence of a single (language) unique category name. In many countries, items have 3 to 5 different names. Categorizing the "translations" creates too much confusion and people move categories all the time because they find that the other official name in the categories are much better. Very often, they add subcategories to the redirected categories with the "better" naming convention. Concerning rivers, we notice that many rivers change name from one country to another, but it remains a problem and only hat notes and galleries alleviate the problem. --Foroa (talk) 13:44, 1 June 2012 (UTC)
I don't see where the problem exactly is if category redirects are categorized. On wiki:fr(or :en), categorized redirects are used to categorize the category name (before the redirection); e.g. here or en:Category:Former named state highways in Oregon where categorized redirections appear in italic. The message of the template is clear enough: this category should be empty (like all redirections), so no risk of confusion (BTW, in the French message, "... and not categorised themselves" is not translated). Jack ma (talk) 14:11, 1 June 2012 (UTC)
Your examples concern articles (galleries) for redirects that really work and redirect immediately. On most wikipedias, category redirects are very much restricted, sometimes completely forbidden, let alone their independent categorisation. Moreover, redirected categories don't appear in italic and show a big empty, which is confusing and makes it very tempting for people to redirect to it. --Foroa (talk) 14:33, 1 June 2012 (UTC)
Ok then. Category:Escaut is fully redirected (with no category), and Escaut is a redirected gallery (italic, in Category:Rivers of France by name). Thanks, Jack ma (talk) 05:01, 3 June 2012 (UTC)
Thank you, sorry about that, I wished we could do better. --Foroa (talk) 07:34, 3 June 2012 (UTC)

Probem since 5 July 2012: template loopEdit

When used in a file, reports a template loop. Should clearly display a red box warning when used outside category space. For galleries redirecting to categories, it should suggest the proper normal redirect syntax, by preference copy/pastable. --Foroa (talk) 08:53, 6 July 2012 (UTC)

You are right, the behavior in files is strange: it includes the category in the file!
Displaying a red "Category redirect should not be used in files" would be better.
By the way, why does this template work in namespaces Template and Commons ?
Cheers 07:15, 7 July 2012 (UTC)
I cannot see any loop in files, how do you get that ? I do not see any reason why anyone would use a category redirect directly in a file, and if she does, the file will be categorized accordingly anyway, so I am not sure that any additional error-checking is needed. But it should be easily fixable with a "iferror" or a "ifexist".
The template works in the Template namespace to help with documentation. It works in the Commons namespace because it is used there. --Zolo (talk) 05:31, 11 July 2012 (UTC)
Being correctly categorized doesn't make it okay to use a template completely inappropriately. For so many reasons. If anyone does use it on a file page, it's obviously a mistake, and we should let them know (although without any evidence people are actually doing this, I don't think it's necessary). The template displayed correctly on Template and Commons (example pages) before your changes, except it didn't add any categories... Rocket000 (talk) 05:47, 11 July 2012 (UTC)
Template generates loop error when used in gallery and file name space, probably in some other name spaces too. --Foroa (talk) 05:51, 11 July 2012 (UTC)
I remove several uses per week in gallery name space: would be nice if template would suggest to use standard #REDIRECTCategory:destination, especially the colon preceding the category. --Foroa (talk) 05:55, 11 July 2012 (UTC)
I really don't think that standard #REDIRECT is a good idea. The current template is much more powerful. Liné1 (talk) 06:05, 11 July 2012 (UTC)
@Rocket: The idea of the namespace switch was to prevent {{Object photo}} from being broken by redirects. Object photo transcludes content from categories, which obviously poses problems but sounds acceptable (see for instance Commons:VP#Template:Object_photo)
@Liné: I do not think the idea was to remove {{Category redirect}} completely (the template is indeed needed though I cannot help but think that there should be a better way to get the same result, as apparently, all redirected categoryies should use category redirect).
@ Foroa:
I tried to generate loops here but did not get any.
I added a custom message for the gallery namespace, better ? Maybe user:SieBot could help maintaining that ? --Zolo (talk) 06:18, 11 July 2012 (UTC)
Gallery name space OK, thank you. {http://commons.wikimedia.org/w/index.php?title=File:1818_map_of_York,_Upper_Canada.jpg&diff=74098515&oldid=74098096 Still template loop in file space]. --Foroa (talk) 06:49, 11 July 2012 (UTC)
Ok, it seems to be only when the category redirect points to a redirect, I do not see any straightforward way to fix it. Is it really bad ? Category redirects on files, should not occur very frequently I guess. --Zolo (talk) 09:12, 11 July 2012 (UTC)
It seem to happen to all cat redirects in files. Not a real problem, it happens only a couple of times per month, and the more red messages it generates, the better ... It doesn't catch the case neither where a redirected cat is included in curly brackets in stead of square brackets, as happens occasionally. --Foroa (talk) 09:24, 11 July 2012 (UTC)
Guys, we all know what does the loop: it is the |#default = {{Category:{{{1|}}}}}
Foroa uses {{Category redirect|Root}} were Category:Root contains {{Category redirect|CommonsRoot}}<nowiki> :Zolo solution with <nowiki>{{error}} will solve that.
Cheers Liné1 (talk) 16:47, 11 July 2012 (UTC)
Zolo, could you replace {{Category:{{{1|}}}}} with your {{Error}} ? Liné1 (talk) 17:00, 11 July 2012 (UTC)
In cases I have tried, there does not seem to be any loop problem. If content is transcluded from a category, and the category is renamed, it is unlikely that the renamer will notice the error message in files. In that case, I think that transcluding the category is better than an error message, as it will appear correctly for the end user. --Zolo (talk) 17:21, 11 July 2012 (UTC)

The real problem is that you are transcluding entire categories on file pages. This will cause infinite problems. There's all kinds of category content, not just templates and categories, that should never be added to other pages automatically, especially not of file pages (the gallery/category content exchange is one thing and possibly workable, but this is on a whole different level). People editing a category shouldn't have to worry about what they're adding being reused (automatically) for an entirely different purpose. Categories are not templates, please don't use them like they are. There's very little benefit of transcluding the category text anyway. Image descriptions should be about the image, not the broader topical category it falls. It makes me cringe every time I see a whole taxonomic hierarchy on images of species. Too much information. If people care about that, they are not going to pick random image to tell them that. That's what categories, galleries, and interwikis are for. Rocket000 (talk) 20:48, 11 July 2012 (UTC)

  1. you just introduced a small bug: [http://commons.wikimedia.org/w/index.php?title=Template:Category_redirect/sandbox&diff=prev&oldid=74139664
  2. I am not sure that Namespace "Gallery" exists. I think that gallery have an empty namespace.
  3. We all know that the solution is this: killing the {{{Category:{{{1}}}}}}
  4. Cheers Liné1 (talk) 06:21, 12 July 2012 (UTC)
Rocket, I tend to agree wtih you for images of species, but {{Object photo}} is used for images of artworks, and there seems to be a consensus for having the whole artwork description on the image page (we still do not have any better solution). It transcludes pages using {{Category definition: Object}}, wrapped within "onlyinclude" so that tools like hotcat still work properly. It is sure not ideal, but so far I have not encountered many problems with that (except for the annoying problems associated with category renaming). --Zolo (talk) 07:43, 12 July 2012 (UTC)
It will cause problems and will continue to do no matter how many workarounds you crate. I guarantee it. Just think about it. If that really is the consensus, I suggest copy and pasting the info instead (maybe that will help show how unnecessary it is to duplicate content multiple times). Rocket000 (talk) 04:27, 15 July 2012 (UTC)

Documentation in SubPage requestEdit

Could an administrator move the documentation in a subpage like in {{ADW}} ? You simply need to copy the text of [1] in the template text.
I already created the documentation as a subpage.
Thanks Liné1 (talk) 06:53, 7 July 2012 (UTC)

You forgot the </noinclude> ;-) Liné1 (talk) 17:27, 10 July 2012 (UTC)

Category:Bad use of Template:Category redirectEdit

When used in incorrect namespaces, Category:Bad use of Template:Category redirect was added.
I liked it and would have like to create other Category:Bad use of Template:XXXXXXXXXX
Since Foroa modification, Category:Broken category redirects is added which is meant for "Redirects to self or non-existent pages", not "bad usage".
I prefer the previous situation.
Best regards Liné1 (talk) 06:21, 7 July 2012 (UTC)

I added that to broken redirects as in general, the items in the Category:Broken category redirects category are corrected in less than 24 hours, which seems better than keeping it hanging around in a non maintained category. --Foroa (talk) 09:12, 9 July 2012 (UTC)
That's a good argument for sure ;-)
Also it is documented in Category:Broken category redirects (See Sortkeys: - = not the category namespace.)
OK, fine for me, I buy it.
Cheers Liné1 (talk) 14:30, 9 July 2012 (UTC)

Use in other namespacesEdit

What is the purpose of namespace switch? This doesn't make sense outside the category namespace... and why does #default (every namespace besides Category, Template, and Commons) result in transcluding the whole category it links to ({{Category:{{{1|}}}}}, while also tagging it as broken)? Rocket000 (talk) 23:47, 9 July 2012 (UTC)

Template_talk:Category_redirect#Probem_since_5_July_2012:_template_loop -Rocket000 (talk) 05:49, 11 July 2012 (UTC)

This template is no longer necessaryEdit

Redirected categories (if using hard redirect #REDIRECT) will be in italics at the bottom of files. So people will be able to know that they are categorizing incorrectly into a redirected category. But this will only work when using hard redirects: #REDIRECT.

So when the italics start showing up for redirected categories we need to stop using this template, and mark it as "deprecated". See Bugzilla:5346 - "make category redirects appear as italics or different colored links." It seems that redirects will now be in italics. Read the comments at the bottom of the bug thread. It talks about Gerrit change #40781. I don't know how long it will take for that to show up here on the Commons though.

For more discussion see the redirect discussions currently at Commons:Administrators' noticeboard, or search for "redirects" in the archives once the discussions are moved there.

Russbot periodically moves files from redirected categories on the Commons to the correct category. See: User:RussBot. That page says "This bot will periodically clean out Category:Non-empty category redirects by moving the contents of redirected categories into their corresponding new categories."

R'n'B, the maintainer of RussBot, writes: "If there were a consensus to use hard redirects, the bot could handle that (with some work to adapt it)." See User talk:R'n'B#Hard redirects of category names. --Timeshifter (talk) 13:46, 28 December 2012 (UTC)

Even if there is no consensus to use hard redirects, RussBot can already be modified to move files from hard redirect categories to destiantion categories. Cheers Liné1 (talk) 17:10, 28 December 2012 (UTC)
Template {{Category redirect}} can only be removed when hard redirects are extensively tested with all tools, especially with items "hanging" in redirected categories. A special non empty category redirects for such cases will be needed. Categories that are included through templates can often not be moved by bots. --Foroa (talk) 18:09, 28 December 2012 (UTC)
See redirect discussions at Commons:Administrators' noticeboard. --Timeshifter (talk) 01:24, 29 December 2012 (UTC)
Those discussions have been moved here:
Commons:Requests for comment/Hard category redirects REDIRECT --Timeshifter (talk) 12:18, 2 January 2013 (UTC)

Problem to redirect Category:21st-century_years_by_countryEdit

21st-century_years_by_country has been replaced but it is impossible to transfer the subcategories, since the cat. in written in a template…

I tried to change the template, but it did not work… if someone can do the necessary work, thank you  

And Happy New Year (a little in advance) --Hsarrazin (talk) 14:38, 31 December 2012 (UTC)

No errors if no parameters are specifiedEdit

If the template is used without any parameters, the template does not show any error messages.

If you just put {{Category redirect}}, the template will say This category can be found at [[:Category:]], instead of telling the user that the first parameter MUST be set. -abbedabbdisk 07:53, 9 October 2014 (UTC)

MediaWiki bug (and solution): missing detection of some non-empty redirected categoriesEdit

The following test in this template:


still does not work when the page name (the category name) contains some characters, notably the apostrophe-quote (') which is very common in page names and category names, and also ampsersands (&), sometimes double-quotes (").

This is a known (very old) bug of MediaWiki (already reported a long time ago and commented, but still not solved):

  • The result of {{PAGENAME}} is HTML-encoded (e.g. an apostrophe-quote in the page name is returned as &apos; or &#39;).
  • But {{PAGESINCAT:...}} still cannot process a category name in its first parameter if it is HTML-encoded (it does not find the category given this incorrect name !).

As a result, when redirecting a category whose name contains some characters (apostrophe-quote, ampersand, ...) and that still contains files, this template will never detect that the category still contains files, and so that renamed category is NOT listed as a subcategory of the new category: these files become uncategorized. And the renamed category is not listed within the category listing all non-empty redirected categories.


  • The problem is in {{PAGENAME}} (and all similar builtin magic keywords such as {{SUBPAGENAME}} or {{FULLPAGENAME}} and even {{NAMESPACE}} on some wikis where namespace names may also contain some sensitive characters such as the apostrophe-quote) that should have never been HTML-encoded (this is made too early by these magic keywords, the HTML-encoding is not to be made during template/parserfunction expansion but during the last parsing step that converts the expanded content to HTML. But it can probably not be changed now (some other tricky templates are expecting that {{PAGENAME}} is HTML-encoded in order to detect if they contain some characters (they can test it by comparing substrings). These magic keywords are clearly inconsistant !
  • The {{#ifeq:}} and {{#switch:}} parser functions are not affected by the bug of PAGENAME, because they contain a workaround that allows to return a successful match when comparing a non-HTML-encocoded litteral string in the wiki code, with a second parameter which may be HTML-encoded at the wrong step (by PAGENAME keyword). But this workaround also has its own problems because now it will match if a page is ever named with a litteral ampersand (yes the pagename C&O is legal for MediaWiki !) with some other code that parse characters or substrings.
  • {{PAGESINCAT:}} could also implement the same HTL-decoding workaround used in {{#ifeq:}} and {{#switch:}} for their input parameters.
  • Note also that there's still no raw option parameter in {{PAGENAME|...}} whose first parameter can also be a litteral string... that will also be HTML-encoded even if it is not so in the litteral wiki code, such as {{PAGENAME|C&O}} which actually does NOT return "C&O" but "C&amp;O" or "C&#38;O", or such as {{PAGENAME|Côte-d'Or}} which actually does NOT return "Côte-d'Or" but "Côte-d&apos;Or" or "Côte-d&#39;Or").


You should HTML-decode {{PAGENAME}} by replacing it by {{#titleparts:{{PAGENAME}}}} in this template:
The fixed version is in the current version (by me today) of its /sandbox subpage.


{{#titleparts:...}} performs the HTML-decoding internally in its first stage (so "Côte-d&#39;Or" will become back "Côte-d'Or", which now can be tested with {{PAGESINCAT:...}}).
  • {{PAGESINCAT:Côte-d'Or}} works as expected and returns "16" because there's still no HTML-encoding (the litteral parameter is just UTF-8 encoded in the wiki code).
  • {{PAGESINCAT:{{PAGENAME:Category:Côte-d'Or}}}} does not work correctly, it returns "0" (PAGESINCAT does not find any category litterally named "Côte-d&apos;Or" or "Côte-d&#39;Or").
  • {{PAGESINCAT:{{#titleparts:{{PAGENAME:Category:Côte-d'Or}}}}}} works again, it returns "16". Details:
    • {{PAGENAME:Category:Côte-d'Or}} returns "Côte-d'Or" which seems correct here (but it is HTML-encoded, and MediaWiki parser will not change it, the HTML-decoding is supposed to have already occured in the 1st stage of parsing the litteral input wiki code, and it will perform the rest of the expansion, it will never reencode it in later stages, but only eventually in the last stage that generates the visible HTML code, for example to HTML-encode the visible ampersands, or lower-than signs);
    • {{#titleparts:{{PAGENAME:Category:Côte-d'Or}}}} returns "Côte-d'Or" which is correct (not HTML-encoded, this is performed only on the last stage by MediaWiki when generating the viewed HTML page).
Additionally after checking if it contains a namespace name, which is stripped, {{#titleparts:...}} enforces the result into into a valid pagename and canonicalizes it:
  • it resolves the relative "../" litteral shortcuts, resolving also "/subpage" by prepending the name of the current page for its missing missing base page); then, if there are two other parameters, it will select the numbered segments separated by "/" to return only those;
  • then it converts the 1st letter to capital (according to the settings of namespace in the the local wiki)... but it does not HTML-encodes the result, as expected.
All this additional work by {{#titleparts:...}} is safe here, as we already have a canonical pagename returned by {{PAGENAME}} (except it is incorrectly HTML-encoded).

verdy_p (talk) 11:25, 8 February 2015 (UTC)

That template is also used indirectly by very few derived templates (with minor use such as Template:Endashcatredirect which will continue to work unchanged).
There may be other templates having exactly the same problem (those used to track various issues in pages, for feeding tracking categories that should remain empty). verdy_p (talk) 14:40, 8 February 2015 (UTC)

Why reverting ?Edit

Requested once again: this has been reverted incorrectly, and redirected categories are no longer counting pagenames in target categories with apostrophes !! verdy_p (talk) 12:39, 23 March 2015 (UTC)

@Verdy p: Hello, Replying here to your msg on my talkpage (so that other users can reproduce the bug) Can you please post the fixed template at Template:Category redirect/sandbox? Then i can copy and past the fix. Thanks. --Steinsplitter (talk) 16:06, 14 February 2016 (UTC)
This is already posted since long (above in the linked sandbox). verdy_p (talk) 16:09, 14 February 2016 (UTC)
Note: you added recently an attempt to detect when the parameter contains the full pagename of the target category. However this template never had this. Parameter 1 can only be a category name without the namespace prefix.
I've not tested your attempt to allow also full page names. My opinion is that your modification to support it is in fact undesirable. The template shouls not be used on any other page except categories. Any attempt to use a namespace should create an error. verdy_p (talk) 16:13, 14 February 2016 (UTC)
(Edit conflict) The edit is removing the {{#ifeq:{{NAMESPACE part which would break the template where it is used with Category:Catname instead of Catname --Steinsplitter (talk) 16:15, 14 February 2016 (UTC)

Categories with quotesEdit

Does the template have a bug with quotes? Category:Ca' Pesaro and some similar ones don't get added to Category:Non-empty category redirects. Federico Leva (BEIC) (talk) 15:43, 13 April 2016 (UTC) {{editprotected}}

It's a magic word bug; its workaround appears to be replacing
.    FDMS  4    17:12, 13 April 2016 (UTC)
  Done --Jarekt (talk) 17:33, 13 April 2016 (UTC)
@Jarekt, FDMS4: Looks like something went wrong, template doesn't show and categorizes a category as Category:Template redirects. --Nenntmichruhigip (talk) 11:02, 30 April 2016 (UTC)
Can you give an example? Category:Ca' Pesaro is in Category:Category redirects, and I don't see any category redirects in Category:Template redirects   FDMS  4    11:34, 30 April 2016 (UTC)
I do not see any issues at the is point. Nenntmichruhigip if there is still a problem, please explain in more detail. --Jarekt (talk) 13:38, 2 May 2016 (UTC)
Looking at it more exactly, I noticed I used Template:Category Redirect (with uppercase 'R') instead of thisone, and the issue has nothing to do with your change. The other tamplate's content is only an inclusion of Template:Template redirect, while it should also contain a redirect instruction. I fixed this redirect now. Category:Template redirects also contains one other template page which is not recognized as redirect by MW: Template:User Cs-admin. This might need to get fixed as well, but differently (by removing Template:Template redirect from it?) as it includes another template with parameters, instead of intending to be an actual redirect. --Nenntmichruhigip (talk) 16:34, 2 May 2016 (UTC)
Return to "Category redirect" page.