Template talk:Category redirect/Archive 1

Archive 1

Administrative

If you think that a category needs redirecting then it is likely that it should be renamed or merged instead. You can list a category for renaming or merging at categories for discussion.

What this template is for

This template {{Category redirect}} is used to create soft redirects from empty, poorly-named categories, or categories where national variation of English spelling differences may cause confusion, to active categories. This should only be done in rare circumstances, as MediaWiki developers are currently working on a software solution (T5311).

Instructions

To redirect from Category:Authors to Category:Writers, simply add the following to Category:Authors:

{{category redirect|Writers}}

Please do not use subst: on the template.

FAQ

  • Q: Why not just use a regular redirect?
    A: That is the ideal solution. However, the MediaWiki software currently has issues with categories and redirects:
    • #REDIRECT [[Category:Whatever]] does do the redirect, but the original category is listed as a subcategory of Whatever.
    • #REDIRECT [[en:Category:Whatever]] works, too, with the same problem as above. Also, this (technically) transwiki redirect fails to send the "redirected from <wherever>" message, which is needed for maintenance.
    • #REDIRECT [[:Category:Whatever]] works as a redirect, but does not prevent articles from being added to the "old" category and prevents the page being listed in the target category. —Preceding unsigned comment added by Sakshale (talkcontribs) 16:21, 31 March 2008 (UTC)
    • #REDIRECT [{{SERVER}}{{localurl:Category:Whatever}}] doesn't work either (and even if it did, it would be a terrible hack).
  • Q: Isn't that creating more work for ourselves?
    A: A little bit, yes. However, many Wikipedians have tried and failed to get category redirects to work, only to realize that it's a shortcoming of the MediaWiki system. Giving them a solution — even if it is a short-term solution — will waste less time in the near future.
  • Q: If Category A redirects to Category B and User C puts Article D into Category A, then Article D won't show up on Category B like it should!
    A: This is an issue being solved by the MediaWiki development team, and it may account for the fact that category redirects do not work yet. As a result, category redirects are to be used lightly for the time being.

Bot FAQ

Written by AllyUnion (talk) 11:07, 3 January 2006 (UTC)

  • Q: How often does the bot check to change and move stuff around?
    A: The robot is discontinued.

Discussion

Comments

Comments are welcome. • Benc • 09:30, 15 Sep 2004 (UTC)

We use something equivalent to this in the portuguese wikipedia and it works very well. [[User:Muriel Gottrop|muriel@pt]] 16:23, 24 Nov 2004 (UTC)

Why limit usage?

The instructions say "This template is used to create soft redirects from empty, poorly-named categories, or categories where AE/IE spelling differences may cause confusion, to active categories. This should only be done in rare circumstances, as MediaWiki developers are currently working on a software solution." I am coming to the opinion that this statment should be changed. All good reference books tell you where to look if you try the wrong entry. So here is an alternate wording:

"This template is used to help direct users to the correct name of a category. It should be used in all poorly-named categories, categories that have been renamed at WP:CFD, or categories where AE/IE spelling differences may cause confusion, to active categories. The template also helps alert editors when they have mis-categorizatized their article."

I suspect that using this template more instead of less would actually create less work. It could in effect change WP:CFD into Wikipedia:Categories to move. Category discussions would be less contentious if the depopulated category remained as a redirect. Perhaps, the software upgrade path is this:

  1. Use this template extensively to create and mark numerous category redirects.
  2. Create a bot that scans Category:Wikipedia category redirects and one category at a time moves miscategorized articles to the correct category. Run the bot frequently.
  3. Upgrade the software so that category redirects work the same as article redirects. (Articles categorized wrong would not show up in the correct category, but this would still be taken care of by the bot if the software upgrade doesn't make it automatic.) Also upgrade the software so that links to redirected categories appear in red.
  4. Using another bot, replace all the templates with "hard" redirects.
-- Samuel Wantman 06:16, 29 July 2005 (UTC)

Modifications

What about changing the code as follows?

#REDIRECT [[:Category:{{{1}}}]]

:''This category is located at '''[[:Category:{{{1}}}]]'''.''

:''Note: This category page should be empty, with all of the articles contained being under [[:Category:{{{1}}}]]. See [[Template talk:Category redirect|this page]] for more information.'' [[Category:Wikipedia category redirects]]

The category is already looked after by a bot anyways. — Instantnood 18:55, 26 October 2005 (UTC)

Would that work? I bet that using {{category redirect|foo}} would tell MediaWiki to include Category:foo as a template. dbenbenn | talk 01:40, 27 January 2006 (UTC)
Yes it does. — Instantnood 20:15, 25 February 2006 (UTC)

Help required

I don't know if this is the place to ask, but i cannot get the category redirect function to work. I am trying to redirect Category:U.S. stage actors to Category:American stage actors - what code do i need and where do i put it? any help gratefully received. thanks Jdcooper 14:51, 11 November 2005 (UTC)

Copied to Wikicities

Copied, almost unchanged, to Wikicities.com, with thanks. "We" have a link to this page so as to keep up with the play. See cities.wikicities.com/wiki/Category:Maine%2C_U.S.A.

Robin Patterson 12:56, 5 November 2005 (UTC)

Category redirects work now - why use template?

Now that #REDIRECT [[:Category:PAGENAME]] works, is it even necessary to use this template? I've simply been redirecting pages like that, since it seems easiest. If the template is preferable, though, I'll gladly switch all the pages I've done so far (and all future category directs) to using the template. I just can't quite figure out from this Talk page whether there's any agreement on what to do, and there's a lot of categories that need moving. -Silence 08:16, 19 January 2006 (UTC)

The problem is that if Category:FOO redirects to Category:BAR, and someone adds a page to Category:FOO, it won't show up in Category:BAR. The template is required so that the redirect appears in Category:Wikipedia category redirects, so that the bot will automatically fix things. dbenbenn | talk 01:39, 27 January 2006 (UTC)
That's not really an issue for most of the categories I deal with: categories with odd names created to go with user templates (like moving "category:user pizza" to "category:wikipedians who eat pizza"). For those, once the user template's category is changed and everyone currently in the category is moved to the new one, it's highly unlikely that anyone will be added to the cat in the future. So, for those should I go with the redirect or this template? -Silence 01:43, 27 January 2006 (UTC)
For those, I think it makes sense to simply delete the category, via WP:CSD (or just {{db|empty cat, replaced by FOO}}). dbenbenn | talk 03:31, 27 January 2006 (UTC)
But I'm not an admin, and there are hundreds of categories which meet my above description of category replacements. Do you truly want me to add a "db" tag to all of those pages? For example, a category like Category:User pirate is completely useless and empty and will forever remain empty until the end of time, with nothing linking to it; it has been replaced by Category:Pirate Wikipedians. A "category redirect" template would be useless because it's highly unlikely that anyone will ever be added to the category in the future, and because a simple redirect would be much faster (and, unlike in the past, is possible on Wikipedia now); without adminship, even bothering to nominate a category for speedy deletion seems like it would require way more work than is feasible, especially since I'd have to provide a justification for every single speedy-delete nomination, and then some hapless admin should have to wade through dozens and dozens of such pages to delete them! Lose-lose-lose-lose-lose. So, again, what should I do? -Silence 22:24, 5 February 2006 (UTC)

Then why not have this template create a working category redirect, and add the category for the bot? Michael Z. 2006-02-06 06:04 Z

Wow. That's a pretty sexy idea. Avoids forcing people to make an extra click to go to the correct page and the hassle of the CfD system, while preserving all the benefits of categorizing such pages and letting bots maintain them. Superb; I'll try it now. Any objections? -Silence 21:30, 7 February 2006 (UTC)
No dice; couldn't get the template to work with redirects, even though the categories themselves use redirects perfectly fine. This template seems to be pretty useless now that hard-redirecting categories is feasible. Unless anyone can find some way to make the template work with hard redirects, it should probably be phased out. -Silence 21:52, 7 February 2006 (UTC)

Everyone seems to have avoided the best, most obvious, solutions: Fix the software so entries added to a category redirect will appear in the correct location, or fix the bot to make such entries appear in the correct location. The bot already moves entries so they don't appear in categories with the template; why not just modify it to move entries so they don't appear in categories that say "#REDIRECT" either? —Preceding unsigned comment added by Brianjd (talkcontribs)

Both things are unlikely. When the software detects a category change to each article (it does), it would check for a redirect, and modify the article text in place, all on a save. We don't do that for any kind of redirect. Difficult. The bot would have to do text search of potentially millions of articles for categories in them that have categories that are redirected. Massively difficult.
--William Allen Simpson 18:50, 30 July 2006 (UTC)
What's difficult? Good programming is difficult, but this doesn't seem like a particularly difficult task. Storage presumedly isn't an issue; can't we add a flag to each category so checking if it was a redirect would be as easy as checking if it existed or not, which we have to do to render the page anyway? Brian Jason Drake 08:49, 31 July 2006 (UTC)
…just modify [the bot] to move entries so they don't appear in categories that say "#REDIRECT" either. I am not aware of a mechanism by which the bot (which doesn't query the Wikipedia database directly) could automatically find #REDIRECT categories without the impracticable expedient of blindly checking every category. It currently requires humans to show it what are category redirects: that's what the {{Category redirect}} template does. --RobertGtalk 11:23, 1 September 2006 (UTC)

I've done the Range Creek article. Why are you objecting? And why is it red? —Preceding unsigned comment added by FourthAve (talkcontribs) 07:50, 13 March 2006

Robot

After the apparent semi-retirement of NekoDaemon, my robot RobotG (talkcontribspage movesblock userblock log) is just about ready to take this over. It will be run ad-hoc starting in the next day or two rather than run automatically every hour, and will log its actions at User:RobotG/Category redirect log. I should be grateful if everyone could keep an eye on this for a while until it beds in. Let me know if there are any problems. --RobertGtalk 16:34, 10 July 2006 (UTC)

The dry run has seemed successful. To see the robot's category moves, see its contributions history; the robot now only logs actions that require human intervention, listing them at User:RobotG/Log, and these are removed as they are dealt with. User:RobotG/Category redirect log is no longer used. --RobertGtalk 09:33, 13 July 2006 (UTC)
The robot is now discontinued with its owner's retirement. --RobertGtalk 07:31, 24 March 2007 (UTC)

Another problems not listed above

Another problems with the #REDIRECT [[Category:Foo]] method above, is that when you click "What links here" at the destination page, the redirect doesn't show up in the links! Carcharoth 13:37, 22 September 2006 (UTC)

  • All redirects pages should include a {{R from...}} template on the line, listed in Category:Redirects and it's subcategories. However, apparently due to the prohibition on such 'Hard Category Redirects' in the past, there seems to currently be no Template:R from other category name(edit talk links history) template or category. Changes always cause some confusion, and whilst such Hard redirects are now supported in system software (as they weren't, and so were depreciated), I confess I don't know the current consensus on using them now. If they're legal, we need such a tagging and autocategorization template which can be made to take the new category name as a forced perameter, and so generate the 'What links here' link you discuss.

It would seem that this discussion needs some further thrashing out. The old tag suggested the pages were BOT moved back when I first ran across it last summer, or perhaps it was the talk page. Now I'm not sure that is still true. In any event, if Hard Redirects are being used at all, we should for consistancy create a 'R from other category' category and template, and apply it aggressively. Perhaps we should raise this at WP:VPP? // FrankB 18:53, 1 January 2007 (UTC) (Xpost to Carcharoth

You know, I must confess to having forgotten that I had ever written the above. Thanks for following it up. I'm not that clear on what goes on here, so it would be best to take it to one of the Village pumps if you want wider attention. Hope that helps. Carcharoth 18:55, 1 January 2007 (UTC)

New Bot

I have proposed a new bot to take over the functionality of the old one. It is currently under review from the bot approvals group. Feel free to comment at Wikipedia:Bots/Requests for approval/SelketBot 3. --Selket Talk 21:22, 17 April 2007 (UTC)

hard redirects

ok, after playing around with this for a bit i think i've found the actual brick wall. first of all, i should say it is completely possible to have a category redirect that belongs to the bot maintained category (i.e. Category A redirects to Category B and can also belong to Category:Wikipedia category redirects, showing up correctly labelled as Category A. If an article is added to Category A it displays Category A on its page and can be moved by the bot already maintaining Category:Wikipedia category redirects). The actual problem comes up with trying to implement it with the templates already in use. Neither transclusion nor substing appear to work. The reason is that code like this:

<includeonly>#REDIRECT [[:Category:B]]
[[Category:Redirect categories]]</includeonly>

for some reason will generate a newline that's invisible in the edit box. The only way to see it is by looking at "Show changes" with the transcluded text versus you writing it in yourself (or a simpler way is to write the code, transclude it, then "Show changes" after adding subst). The way that the Mediawiki software currently runs is that redirects need to be written on the VERY first line. There are three ways of solving the problem. The first is to develop a way to write the code so the newline isn't being put in. the second is to have a bot do a regex replacement of this template with the physical code - an AWB bot could do it, appending Category:Wikipedia category redirects as well - we would then have two bots running, one to manually replace instances of this template and the other to maintain categories. The third option is to bring it to the attention of the mediawiki software team and ask them to fix this apparent bug. -ΖαππερΝαππερ BabelAlexandria 05:21, 19 June 2007 (UTC)

Should interwiki links appear on the redirect category itself or at the category being used? For example, most other language wikipedias use Category:Fabaceae instead of what we use here: Category:Legumes. Should I move the interwiki links to the Legumes category? And should I place {{nobots}} on the category page to prevent interwiki linkbots from relinking? --Rkitko (talk) 04:22, 1 September 2007 (UTC)

OK, let's discuss

These changes to the template were reverted by User:Eliyak on the grounds that "changes apparently were not discussed; and are probably not such a great idea." OK, so let's discuss. The changes did two things: (1) changed the current garish-looking box to a more standardized message-box format, (2) changed the text to note that most recategorization is done automatically (currently by RussBot). There's no need to encourage users to spend their time doing manual recategorization when it's going to be done automatically anyway. I don't see why either of these should be a big deal, but anyone who wants to comment please do so. --Russ (talk) 13:54, 17 December 2007 (UTC)

A message template is obviously not intended for bots. It is intended for people to read, and this is one that especially needs to be noticed, so it is quite prominent. Let's not change it on the basis that people will not read it- it is intended only for the people who do read it.
Also, the template standardization via ambox was only for article templates, not category templates. A seperate process took place for talk page templates. One for category templates never really got off the ground. A reason not to use ambox for categories is precisely this: ambox was designed to make template messages less obtrusive on articles. Categories, however, are more of a back-end side of Wikipedia. This template in particular is especially important to be prominent, since it is to help users avoid the mistake of improper cateorization. If it is not readily apparent that the category does not exist at this apparent location, mistaken categorization there will become increasingly rampant. --Eliyak T·C 22:02, 18 December 2007 (UTC)
I would suggest that discussion of these changes should realy take place at WikiProject Categories. --Eliyak T·C 22:06, 18 December 2007 (UTC)
Fine, I'll reply there. --Russ (talk) 00:13, 19 December 2007 (UTC)

Request for comments on template appearance

  • I have proposed to revise the appearance of this template due to two concerns. (1) The current template is ugly (in the eyes of this beholder). (2) The text is misleading, as it suggests that users should manually perform a task (recategorization) that is normally performed by a bot. Eliyak has reverted these changes pending further discussion, so I am requesting that interested users comment below. Russ (talk) 19:41, 24 December 2007 (UTC)
    • The template currently appears like this:
This category is located at Category:Wikipedia maintenance templates.
Note: This category page should be empty. All entries should be recategorized under Category:Wikipedia maintenance templates. Any assistance in making these changes is greatly appreciated.


See instructions for more information.
    • Alternative 1 would appear like this:
    • Alternative 2 would appear like this:
    • Alternative 2 Revise #1 would appear like this:
Note:this was copies from below to make it easier to compare 19:07, 12 January 2008 (UTC)


Comments

  • I can't choose between the two alternatives to be honest. They are both fresh and appealing and fit the current template fashion. I don't see any reason not to update the aesthetics of the template, it was done once before because someone thought pink was ugly. Hiding T 13:21, 7 January 2008 (UTC)
  • I like the bold and image of the second alternative. It's clear that it's a redirect and not just an informational (and hence ignorable) message. --Kbdank71 21:24, 11 January 2008 (UTC)
  • I prefer the bold and the image in the second alternative too. You might consider making the small font a little bigger though (more like the way it is in the original template). Right now, it makes me want to skip over it. Thank you for thinking to update this! LeSnail (talk) 21:39, 11 January 2008 (UTC)
  • I prefer the color and image in the first alternative but think both are far superior to the current. I agree with the sentiment that the bold is better than italics and the note should be in a larger font. As far as the explanation that the task is normally done by a bot, I don't think it's strictly necessary but in this case I think more information doesn't hurt. Stardust8212 22:12, 11 January 2008 (UTC)
  • This overhaul is long overdue. I have no preference for either one. —Viriditas | Talk 22:20, 11 January 2008 (UTC)
  • I'll take alternative two. The current color scheme is horrendously painful. - auburnpilot talk 22:34, 11 January 2008 (UTC)
  • Overhaul needed, I like alternative two, and especially prefer the symbol in #2. --Paleorthid (talk) 22:42, 11 January 2008 (UTC)
Alt 2 Rev 1 is better improvement. -- Paleorthid (talk) 19:17, 12 January 2008 (UTC)
  • I'll take alter 1,I think that is the best choice for redirect template —Preceding unsigned comment added by Wooerfara3661 (talkcontribs) 22:46, 11 January 2008 (UTC)
  • I think alternative 2 looks much cleaner, which is odd when you consider there's not actually much difference between the two! Waggers (talk) 23:03, 11 January 2008 (UTC)
  • Choice number 2 is very direct. If you need any more opinion from me, please do not hesitate to contact me. --Jw21/PenaltyKillah VANucks|24-14-4 23:50, 11 January 2008 (UTC)
  • I agree with everyone's preference for the image of #2, for the same reasons that they gave. And now I admit I feel like an idiot for having done of bit of bots' work in the past… ;) Oh well   Lenoxus " * " 23:55, 11 January 2008 (UTC)
  • I prefer alternative 2. Whichever is used, the overhaul is clearly needed. The revert was against guidelines (Help:Reverting) and probably unhelpful in that it has made a small drama over a decent edit. But we all do these things at times with the best of intentions. SilkTork *What's YOUR point? 01:17, 12 January 2008 (UTC)
  • I would suggest alt#2 as well. The redirect symbol and the orange color of the bar make it stand out from other general informational notices. Dbiel (Talk) 03:29, 12 January 2008 (UTC)
  • Yes, I prefer alternative 2 too. However, I feel that the footnote should be larger in size, as it makes this template, which was intended to be a simple one, look a bit too messy. Acs4b T C U 04:59, 12 January 2008 (UTC)
  • Choice 2 is more indicative, but why is "see" italicized? And for that matter, why is the category name italicized when the rest of the line isn't? It seems conventional only to italicize a whole line. But since this isn't a hatnote but a clear maintenance box, I suggest removing all italicization. –Pomte 06:11, 12 January 2008 (UTC)
  • No. 2 gets the point across best. Concur that the ugly old-school template does need replacing; it's important, in a subtle way, that our templates be consistent. Concur also that the "Note:..." text is in too-small a font size. This probably also means that the text itself needs to be pared down, since it seems to be in a small font size because of its yakkety-yak length to begin with. Further concur with Pomte on the italicization. — SMcCandlish [talk] [cont] ‹(-¿-)› 06:55, 12 January 2008 (UTC)
  • I prefer alternative 2 because you can see what it's referring to at a glance, but you have to read further with alternative 1 and also both alternatives fit in with the design of the other tags. Kathleen.wright5 07:23,12 January 2008 (UTC)
  • In response to some of the comments offered above, here is a proposed consensus alternative: Russ (talk) 13:10, 12 January 2008 (UTC)

Resolution

HotCat and softredirects

I've been taking a look at this because of WP:HOTCAT. The tool already makes a lot of API queries, and I'd rather have to avoid having to read a page to check if it is a "soft redirect". Now, going trough all of this I see no reason, why we cannot program a bot to add HARD redirects in front of all the pages that include this template and then change this template to only include the category Category:Wikipedia category redirects. The bot would still be able to work as far as I know, since we can add categories to the redirect page using this current template. The one ability we loose is, the ability to show the users a message when they visit the redirected category.

See also:

Does anyone know btw, which bot currently takes care of the redirected categories ? --TheDJ (talkcontribs) 10:52, 19 June 2008 (UTC)

Proposed change

This is directly responsive to the previous discussion section. I am proposing a major change to this template based upon the ability of a bot to detect and automatically moves pages that have mistakenly been placed in a redirected category. (Those familiar with how category redirects now work can skip the Background section and proceed directly to the Proposal below.)

Background

Redirects of category pages, although technically possible, do not work in the way a casual user might expect. To take a tangible example, suppose Category:Authors were to contain the following text: #REDIRECT [[:Category:Writers]]. If a user then were to type "Category:Authors" in the search box, or follow an internal or external link to that category page, they would be redirected to Category:Writers, just as if they had searched for or followed a link to a redirected article.

However, if an editor places a link [[Category:Authors]] in the text of an article, such as Mark Twain, the Mark Twain article will remain in the redirected category (Authors) and will not be transferred to the target category (Writers). If a user sees the Category:Authors link at the bottom of "Mark Twain" and clicks on it, she will be redirected to Category:Writers, which as noted before will not contain the Mark Twain article or any other mis-categorized articles. Further, the editor who placed the link in the Mark Twain article is unlikely to notice his mistake, because the link is blue, after all, so it looks like a perfectly valid category.

The solution that has been used up to now is the soft redirect, implemented by this template ({{category redirect}}). For example, Category:Authors currently contains the text {{category redirect|Writers}}. This places a message box at the top of Category:Authors that tells users that the category has been redirected, but they then have to click on the link to be transferred to the target category. (You can see this in practice by clicking on Category:Authors.) The benefit of the soft redirect is that mis-categorized articles (such as "Mark Twain" in the example above) remain visible to readers, and to editors who can replace the link to "Category:Authors" with "Category:Writers" in those articles. The detriments, however, are that users have to go through the exercise of following the redirect to the target category, and that relevant articles may remain in the wrong category indefinitely. To mitigate the latter problem, a bot (currently RussBot, although there were others previously) goes through the categories periodically and moves mis-categorized articles, but this doesn't address the first concern.

Proposal

I propose to revise the RussBot code to change all existing category redirects to normal (hard) redirects. This template would become invisible (except when editing a redirect page), and the argument would become optional; the only purpose of {{category redirect}} would be to place all redirects into Category:Wikipedia category redirects, so that the bot can find them. It would be purely a maintenance template that non-editors never see, like {{R from misspelling}} and other redirect templates. In the example given above, the text of "Category:Authors" would be changed to read— #REDIRECT [[:Category:Writers]] {{category redirect}} RussBot would go through the category of category redirects (currently it does this once a week), and move all misplaced articles into the correct target categories.

This proposal should have the following benefits:

  1. Users will not have to click-through twice to follow a redirected category link.
  2. Category redirects will appear on Special:BrokenRedirects and Special:DoubleRedirects, which they currently do not, making maintenance easier.
  3. The bot will keep mis-categorization of articles to a minimum.

The proposal does have the following disadvantages that I can see:

  1. Mis-categorized articles will remain "invisible" (that is, they will not be placed into the correct target category) for some period of time between bot runs. (Currently, these articles are at least visible in the redirected category until they are fixed.) This can be mitigated by running the bot over "frequently used" redirect categories more often.
  2. The whole system depends on the bot; if it stops running, mis-categorized articles will remain invisible indefinitely. To mitigate this, I am prepared to post the bot code so that someone else can run it if I don't.

I should also note that, when editors disagree over the appropriate title of a category and create redirects back and forth, the bot will move the articles "blindly" without regard to which editor is "correct." This is true of the existing code and would continue to be true if this change is adopted. Editors need to reach consensus on category naming, preferably at WP:CFD, if there is a dispute.

Please add comments and suggestions below. --Russ (talk) 18:45, 26 June 2008 (UTC)

Comments

  • Per my earlier posting on this page, I fully support. --TheDJ (talkcontribs) 18:50, 26 June 2008 (UTC)
  • Sounds like a great idea, but yes the bot should run more often, once or twice a day perhaps. I think the API would be the most efficient way to check for mis-categorized pages, e.g. [1], but there's a good chance you're already using that. — CharlotteWebb 18:25, 2 July 2008 (UTC)
  • I have no problem with the principle of direct arrival to the target page, but I believe that the current message should remain on the category-redirects, informing anyone who should see the pages about their special status. Is there a way for this template to override the redirect notices so that we could avoid visual redundancy? (I am not very optimistic, but you will agree that I had to ask.) Waltham, The Duke of 18:36, 5 July 2008 (UTC)
    • I think that will require changes in the software, and I'm not sure if the devs are for that. Alternatively we could perhaps add a message to the target of the redirect that lists what categories are redirecting to the target and that any stuff in the redirected cats will automatically be moved by a bot ? --TheDJ (talkcontribs) 23:08, 5 July 2008 (UTC)
  • I prefer a soft redirect. Since I find it unwise to depend on that a bot will always be around to take care of moving pages. And even after a bot has corrected the categorisation of a page it can take several days before the category lists are updated. (Category list updating is a very low priority task in the MediaWiki servers.) And as long as the bot is running the "click through twice" will be very unusual, since the pages that point to the wrong category will quickly be fixed by the bot. Thus it seems you are trying to fix a problem that doesn't really exist. --David Göthberg (talk) 03:55, 7 July 2008 (UTC)
    • Well the problem would be that softredir-categories are now listed as normal categories technically, instead of as redirects. This cause tools, API results, statistics etc to be skewed. That's the problem that we intended to solve. --TheDJ (talkcontribs) 10:33, 7 July 2008 (UTC)
      • Oh, thanks for the explanation TheDJ. And ouch, that makes it a tougher choice. But it still feels bad to depend on that the bot is running. But I am uncertain. But hey, can't we instead have the bot check that the {{Category redirect}} template is linking directly to an existing non-redirected category? (I admit I don't know much about these things, just throwing out ideas in case they might be good or inspire a better solution.) --David Göthberg (talk) 11:56, 7 July 2008 (UTC)
  • I think I'm going to lean toward the soft redirect solution for now, for the same reason. We can't guarantee that a bot will be around to move articles. (which, btw, one of the earlier bots checked to make sure the last edit was an admin before moving articles (to avoid edit wars and such); what happened to that?) I'll think about it some more, though. —Preceding unsigned comment added by Kbdank71 (talkcontribs) 21:01, 11 July 2008
  • What would I need to become one of the people who could run the bot? Hiding T 09:35, 22 July 2008 (UTC)
    • You would need (a) the Pywikipediabot software installed on your computer; (b) the bot code (see below); and (c) approval from WP:BRFA to run as a bot account. The bot code isn't available yet, but I plan to post it within the next week or two, as soon as I am sure I have gotten all the bugs out. At this point, however, the bot will not convert soft redirects into hard ones, since there doesn't seem to be a strong consensus for that change at this time. --Russ (talk) 11:53, 22 July 2008 (UTC)

Template should redirect to category, not article

{{editprotected}} The wikitext of this template currently states: "All entries should be '''recategorized''' under [[:{{#ifexist:Category:{{{1}}}|Category:{{{1}}}|{{{1}}}}}]]". I'm not sure that the #ifexist statement is useful, and would replace it with "[[:Category:{{{1}}}]]". If the category does not exist, then it should display as a red link so that an editor can create it. There is no reason for the template to default to an article, as it is not possible for articles to be recategorized under other articles. I discovered this problem because I had assumed that the template was linking to a non-existent category (e.g., "Category:Jewish Singaporeans"), which I could then create by clicking on the link. What I then discovered was that I had inadvertently created articles (e.g., "Jewish Singaporeans") instead. — Cheers, JackLee talk 12:26, 9 August 2008 (UTC)

  Done eminently sensible. Happymelon 14:37, 9 August 2008 (UTC)
Thanks! — Cheers, JackLee talk 08:07, 10 August 2008 (UTC)
I think the purpose of that ifexist was to make it possible to take both "Category:Something" and "Something" as valid parameters. But yeah, since that causes problems I think it is better to not have that ifexist there. So I think agree with this update. However, you will now have broken any existing uses that feed "Category:Something". Since this template is used on 6600 pages we can not check that manually. But I know a way to check that automatically. I will do that in some day when I get the time. (Now noted on my to-do list.)
--David Göthberg (talk) 17:37, 9 August 2008 (UTC)
Yes, but my point is that having "Something" (as opposed to "Category:Something") as a parameter doesn't really make sense because the statement "[a]ll entries should be recategorized under [name of an article instead of a category]" is illogical. I'm not sure what you mean by the template now breaking existing uses that feed "Category:Something". Doesn't it still direct users to categories? — Cheers, JackLee talk 08:07, 10 August 2008 (UTC)

Jacklee: The "ifexist" code that the template had before meant that you could use the template in both these ways:

{{category redirect|Writers}}

{{category redirect|Category:Writers}}

And both would produce a link to Category:Writers. But if you now feed "Category:Writers" to the template it will produce a link to Category:Category:Writers. Here is the result of the two lines above (substituted so this example will be the same in the future):

This template should only be used on category pages.
This template should only be used on category pages.

Problem is that some users think they should feed the whole category name, that is "Category:Writers" instead of just the "Writers" part. I did that myself the first time I used this template. But then when I read its documentation more carefully I noticed my mistake. Apparently others have had the same experience and decided to make the template handle both cases correctly. And since they made the template tolerate it instead of for instance report an error then it is likely that there are a lot of cases out there that feed full category names like "Category:Writers". Thus now that you guys removed the ifexist code all those cases will be broken and have links like Category:Category:Writers.

But as I hinted at above, I prefer that a template only accepts one way to take a parameter. Since accepting several ways will cause all kinds of trouble in the future. If one expects another way to feed a parameter to be common then one should instead detect that case and make the error visible in some way. Of course, in some cases it is hard to decide which is the best way the parameter should be fed. Like in our case here, both "Category:Writers" and "Writers" feels like a natural way to feed that parameter.

What I will do is to add detection of the "Category:Writers" case and make the template report all those cases to a special "error category". Like I have done before for several templates. See for instance {{shortcut}} and its error category Category:Wikipedia shortcut box first parameter needs fixing. This means we can find all those cases and fix them. And we might even want to leave the error reporting forever, since our experience is that people do notice such long error category names at the bottom of pages and do click on it and read up on and fix the error they did! (Thus having a long descriptive name for the error category is a good thing.)

In this case an ifexist will detect and report all cases where the name fed doesn't point to an existing category. Which will be nice. Since this means we will detect several different error cases like full names "Category:Writers", or misspelled names "Writres" or even if the category redirected to have not yet been created. Since you should not redirect to a category that have not yet been created, right?

By the way, normally you should first add such error reporting, then fix all the cases, then change the template to not support the old way to take parameters. And note that it takes up to two weeks before all cases are reported in the error category since Wikipedia runs categorising as a very low priority task.

--David Göthberg (talk) 18:10, 10 August 2008 (UTC)

Oh, now I understand what the #ifexist statement was trying to achieve. The problem was that the template assumed that the only possible inputs were "Category:Foo" and "Foo", and that "Category:Foo" existed. What happened to me was that I first added the template to a page and made it point to a non-existent category, then clicked on the red link to create the category (at least that what I thought I was doing). What do you think – is it likely that other editors will do what I did? If only there was a way to actually detect whether the parameter passed to the template begins with "Category:", and if it does to trim those characters off... — Cheers, JackLee talk 19:36, 10 August 2008 (UTC)
Right. I think that many editors will try to add full category names like "Category:Writers". But we can detect, report and handle that as I describe above. I don't think that that many editors will create articles by mistake like you did, but your case shows that it might happen sometimes. And as you point out we can not check what a string starts with, we can only check if the page linked to exists. All this together seems to indicate it is best we allow "Writers" but disallow "Category:Writers" as input. Since then our code can add on "Category:" and then check if the category exists.
Doing it the other way around will not detect as many error cases. That is, if we allow "Category:Writers" but disallow "Writers" as input then we can not properly detect the "Writers" case since "Writers" might exist as an article. Since then we do not add on the "Category:" string and there often is an article with the same name as a category.
To me it would feel more natural to have "Category:Writers" as the valid input, but it seems others prefer "Writers", thus it is a matter of taste. Thus I think we should go with the case where we can detect and handle the errors the best, thus "Writers" is the best input. And by the way, its not a problem if people add the redirect before they create the new category. They will get a red link and an error category will be added at the bottom of the old category page. But as soon as they click the red link and create the new category the error reporting will disappear. (Well, they need to reload the old category page too.)
--David Göthberg (talk) 20:06, 10 August 2008 (UTC)
I have implemented the error reporting. See CAT:CATREDFIX for explanation. As I thought there are a lot of cases of feeding the full category names, as in "Category:Writers". So far 465 cases are listed, but it usually takes up to a week before a category gets fully populated. That is, 465 cases out of a total of 6600 categories that use {{category redirect}}. I hope you guys have time to work through that list? Since I am way to busy both here at Wikipedia and in real life.
--David Göthberg (talk) 10:28, 11 August 2008 (UTC)
Sounds like a job for... Superbot! — Cheers, JackLee talk 17:08, 11 August 2008 (UTC)
The "Category:Category:" issue, at least, can easily be fixed by a bot. I can do it next week, probably. In the meantime, don't waste effort fixing those manually. Russ (talk) 17:47, 11 August 2008 (UTC)
Thanks, yeah this is a job for a bot. I took a look at a bunch of the cases in the list and nearly all is the "Category:Category:" issue, thus the bot should be able to take care of nearly all the cases.
--David Göthberg (talk) 18:39, 11 August 2008 (UTC)
I got impatient, so I asked the nice guys over at Wikipedia:Bot requests to do it. And Maelgwnbot did the job. That left 11 tricky cases. I handled most of them. Now there are 4 empty categories left that in turn are redirected to non-existent empty categories. I think we should delete those 4 categories. (The empty categories are Category:British Mozambicans, Category:Chinese Mozambicans, Category:Mexican Koreans and Category:Spanish Koreans.)
--David Göthberg (talk) 01:43, 16 August 2008 (UTC)
Well done, and thanks for giving so much attention to this issue. Do the empty categories qualify for speedy deletion? If not, list them at CfD. — Cheers, JackLee talk 05:20, 16 August 2008 (UTC)
Yes, I think they should be speedily deleted. But I am a bit new as admin, and as far as I can see the rules in Wikipedia:Criteria for speedy deletion doesn't fully describe the case of a redirected category. So I wanted a second opinion.
Well, if one reads the CSD rules literally then they are not CSD C1, but they are CSD R1, so are allowed to be speedied. But reading those rules literally would allow to delete a category redirect to a non-existent category page, even if the category itself and/or the target category had items categorised in it. So I think it is sane to apply the rule in CSD C1, that is that they should be unpopulated for at least four days. I guess that rule was made since people might be edit warring over how to categorise some pages, or someone might have damaged a template that was categorising pages into that category, or other reasons might do it so pages come in and out of the category. Thus waiting some days and checking in some times during that time to see if some pages show up in the category might be wise.
--David Göthberg (talk) 07:29, 16 August 2008 (UTC)
Yup, if I were you I'd wait four days, and if no one creates the non-existent categories or populates them, I'd go ahead and delete the redirects. — Cheers, JackLee talk 14:11, 16 August 2008 (UTC)

New categorization ideas

I happened across the Commons version of this template, and found that it uses a clever categorization scheme to collect pages that need to be moved out of redirected categories. Basically, instead of

{{category other | [[Category:Wikipedia category redirects|{{PAGENAME}}]]<!-- Reporting if the first parameter is not a valid category name: -->{{#ifexist:Category:{{{1|}}} | | [[Category:Wikipedia category-redirect box parameter needs fixing|{{PAGENAME}}]] }} | :::::This template should only be used on category pages. }}

it uses

<includeonly>{{{category|{{#ifeq:{{PAGESINCAT:{{PAGENAME}}}}|0||[[Category:Non-empty category redirects]]}}{{#ifexist:Category:{{{1}}}|[[Category:Category redirects|{{PAGENAME}}]]|[[Category:Broken category redirects]]}}}}}</includeonly>

If this looks good to other users, maybe we can incorporate it into our version of the template (with appropriate adjustments to the category names). --Russ (talk) 18:51, 21 August 2008 (UTC)

The second part with the "#ifexist:" works exactly the same as our "Reporting if the first parameter is not a valid category name", so that part we already have.
For the outer part we use the {{category other}} instead of includeonly tags, since that is better. It makes it so we only categorise when on category pages. Thus we don't categorise pages like Wikipedia:Template messages/Category namespace that show/demonstrate the template. So that part we do better.
The interesting part is the {{PAGESINCAT}} logic, since we don't have that one. It is supposed to report if a redirected category has pages in it, by listing itself in the "Category:Non-empty category redirects". However, I don't think that one works as well as one first might think. Because parserfunctions and magic words are only parsed when a page is (re)rendered. And a page is only re-rendered when someone visits it, and if the user isn't logged in then it is only re-rendered if the version in the cache is more than one week old! (Unless for instance a template in the page has been updated, since then the page has been purged from the cache by the job queue, and then it is re-rendered on the next visit even if it is an IP user.) An example is that magic words like {{CURRENTTIME}} and {{CURRENTDAY}} can be up to one week wrong when a page is viewed by an IP user! Now consider that many of the redirected categories almost never get any visits. Thus that {{PAGESINCAT}} logic will almost never be activated to report the number of pages in such rarely visited redirected categories. It might take more than a year before we get to know that one of the redirected categories is full of pages.
Because of this we instead have a bot that goes around taking a look in all the redirected categories every now and then to see if they have any pages in them. Oh wait, that is RussBot, your bot. :))
Of course, the MediaWiki software is constantly updated, and it was some time since I read up on these things. So we should test if the {{PAGESINCAT}} logic works faster than I think. If nothing else to be able to report to the commons people that their template is broken. (But I hope I get pleasantly surprised and learn that I am wrong.)
I have started such a test. Now waiting for the categories to be updated. (Wikipedia runs category updates as a low priority task, so can sometimes take hours or even days before a category comes in or out of a category listing.) I'll report back when I have the result.
--David Göthberg (talk) 21:19, 21 August 2008 (UTC)
Great, I look forward to it. By the way, it's not my experience that categories take days or hours to update; if a page that directly includes a category link is edited, I generally see the change in the category's contents immediately. If the edit is to a template that is transcluded onto other pages, then it does sometime take minutes or hours (rarely days) for the change in the category to be propagated. --Russ (talk) 21:57, 21 August 2008 (UTC)
Right, if a template is changed then all the pages that uses that template are pushed out of the cache. And yes, it seems the devs have changed the software some time ago since nowadays most of those pages pretty fast come into the category that the template uses. Much faster than they possibly can have had users visiting them. But some time ago we noticed that the categorising of category pages seems to run at a much lower priority than categorising of other pages. (Perhaps the devs think that we don't change categorising of category pages that often.)
But the case we are testing here is different. We are one step further away from what changed. That is, some page gets changed (or a template in the page gets changed), the page then categorises into the deprecated category (which since some time back is marked with our {{category redirect}} template), the deprecated category is then supposed to detect that it now has pages in it and report that by categorising itself into our detection category "Category:Non-empty category redirects". Problem is that the deprecated category did not have any change of its page, so it doesn't get re-parsed just because the number of pages in it changed. On a category page the page content (upper part) and the category list (lower part) is treated as separate things by the software.
Unfortunately I might be right, since so far my test has failed. That is, the previously empty "deprecated" category that I have now inserted a page into has not reported itself to my detection category. To check that I had not missed anything I tested it: I inserted a page into the deprecated category and waited several hours, but it didn't report itself. Then I visited the deprecated category and saw it had one page in it, but still no reporting. I purged the category and still no reporting. Then I did a dummy edit (added a comma), then it reported itself immediately to the detection category. (Odd, I thought it should be enough to just visit it, or at least just to purge it.)
Now I have restarted the test by first emptying and editing the deprecated category to make it stop reporting itself. Then I inserted the page into it again and started waiting. I am going to wait at least two weeks without visiting the deprecated category to see if it eventually reports itself. (Since just some months ago some categorising stuff took up to two weeks in the worst cases.) I will of course check the detection category every now and then, and report here if the deprecated category becomes visible.
--David Göthberg (talk) 15:11, 22 August 2008 (UTC)
David, your analysis appears sound to me. I asked the user on Commons who came up with this scheme, and he basically said he wasn't sure how the category updates worked, either, but that it seemed to work because lots of categories show up in his "Non-empty" category on a regular basis. He suspects that {{PAGESINCAT}} may be recalculated whenever the category page is rendered. Even so, not many users are likely to be viewing redirected category pages, so maybe there is a bot running through and touching all the category redirects on a regular basis? Oh, well, at this point it's mainly an issue of curiosity for me, not a practical concern. --Russ (talk) 16:09, 22 August 2008 (UTC)
Right, the {{PAGESINCAT}} is supposed to be recalculated each time the category page is re-rendered.
"Regular basis"? Oh, I see!!! There are bots visiting most pages on a regular basis. That is, the web crawlers (collecting data for Google and other search engines) and the spam crawlers (searching for email addresses that the spammers can use). It wouldn't surprise me if such bots visit even our redirected category pages every now and then, since some of them crawl really aggressively. This would mean this detection method perhaps will work, albeit a bit slowly. (But hey, Wikipedia has no deadline!) Hahaha, funny idea that our detection system would be powered by spam crawlers!
I just checked some old test templates and other odd pages I've made, some of them have not had any visits for months. But I think I read that Wikipedia filters out known crawlers from its statistics. But some of those pages had exactly one visit per week, indicating an automatic visit.
And yeah, I do this test partly out of curiosity. Since I have noticed that the more I learn about MediaWiki/Wikipedia and its quirks the better work I can do here.
--David Göthberg (talk) 17:23, 22 August 2008 (UTC)

The thing is that commons:Category:Non-empty category redirects gets fill pretty fast (it fills up while my bot's emptying it), however, the cats are extremely slow leaving the category after they are empty. Better than the other way around I guess. I was wondering if __INDEX__ might help anything. Rocket000 (talk) (the person who did this on Commons) 02:37, 23 August 2008 (UTC)

Yes, categories get added much faster than they are removed here at en.wikipedia too. I guess the devs have set category removal as a much lower priority task to save some load when the servers are busy.
Right, the magic word __INDEX__ makes it so MediaWiki marks the page with the special HTML meta-tag that tells search engines to index the page. Which might make them visit it more often. Which in our case probably would increase the chance for the page to be re-rendered on a regular basis. However, that would also make it so the search engines show our redirected categories in their search results, and I wouldn't like that. And making more search crawlers visit the page probably costs much more resources than having a toolserver based bot that visits with a proper time interval.
And a status report on my test run: The "deprecated" category has not yet shown up in my "detection" category.
--David Göthberg (talk) 12:55, 23 August 2008 (UTC)
Yeah, I guess we wouldn't want our redirects being indexed. I think the best solution (if we really needed the category to stay updated all the time) is to have a bot cycle through all category redirects at a slow but constant rate and dummy edit each one. It would make the most sense if this trivial task could be preformed by the same bot that recategorizes them. Rocket000 (talk) 22:54, 24 August 2008 (UTC)
If the bot anyway visits the category then it doesn't even need to make an edit or purge since the category list in the category page usually gets updated already by viewing the page. Thus the bot already gets the information it needs. So it seems the current way with a bot is a good way.
But I have figured out a way that might cost less resources, both for the Wikipedia servers and for the bot:
The bot knows which categories are redirected, I guess by looking at "what links here" for the {{category redirect}} template, right? So the bot can make a list of all redirected categories, and format that list like this: {{PAGESINCAT:Somecat1}}, {{PAGESINCAT:Somecat2}}, {{PAGESINCAT:Somecat3}}. Then it can create (update) a page with that list (well several pages since the list has about 7000 categories now), and then it can simply load those list pages to find out which redirected categories are not empty.
I have tried it and it works fine. In my current test run the "deprecated" category has not yet shown up in my "detection" category. But look at this: According to {{PAGESINCAT:}} the number of pages and subcats in my "deprecated" category is right now: 0. And that is correct! No need for the bot to visit the category. (Now please don't visit that category to check that since that would ruin my test run. I know I have one page inserted into it.) This is so efficient that I could even create that list manually. (With some help of the automatic edit function in my text editor.) But of course, better that the bot does it since it can then handle the pages in the redirected categories etc.
--David Göthberg (talk) 07:53, 25 August 2008 (UTC)
I could have RussBot do this on its next run. Basically, just a page listing every category in Category:Wikipedia category redirects along with its {{PAGESINCAT:}} count, right? There are 0 category redirects at the moment. --Russ (talk) 12:29, 25 August 2008 (UTC)
Right and right.
Oh, and now when I edit this page I see how you counted the number of soft category redirects: {{PAGESINCAT:Wikipedia category redirects}}. Nifty!
By the way, since I am curios: I have noticed that RussBot finds and changes hard redirects to soft redirects. How does it find those hard redirected categories?
--David Göthberg (talk) 14:08, 25 August 2008 (UTC)
Using the API, it is quite easy to generate a list of all pages in the category namespace that are (hard) redirects. See http://en.wikipedia.org/w/api.php?action=query&list=allpages&apnamespace=14&apfilterredir=redirects --Russ (talk) 14:18, 25 August 2008 (UTC)
Wow! I took a look at the API. We don't need the {{PAGESINCAT:}} anymore. We can use the API to get what we need. Way more efficient.
The link below is a query that generates a 500 long list of all subcategories of "Category:Wikipedia category redirects", and then shows their "prop=categoryinfo". That is, it shows how many pages and subcategories the soft redirected categories have:
http://en.wikipedia.org/w/api.php?action=query&generator=categorymembers&gcmtitle=Category:Wikipedia_category_redirects&gcmnamespace=14&gcmlimit=500&prop=categoryinfo
Russ: I assume you already know how to then continue the query with the next batch of 500 subcategories.
And we can also check if the categories that have hard redirects have any pages in them:
http://en.wikipedia.org/w/api.php?action=query&generator=allpages&gapnamespace=14&gapfilterredir=redirects&gaplimit=500&prop=categoryinfo
Note that the search for hard redirects above is set to show max 500 but there currently are only about 200 so that search shows all of them.
For some reason the API searches above doesn't show the "prop=categoryinfo" for all categories that they list in those searches. Either I misunderstand something or there is a bug. But still, it shows the categoryinfo for most of them and that is a good start. And if it is a bug then I hope we can get the devs to fix the bug.
--David Göthberg (talk) 18:43, 25 August 2008 (UTC)
It looks like a large enough fraction of the pages are missing the <categoryinfo> member that this could be a problem. I'll see if I can puzzle out what's wrong. --Russ (talk) 20:04, 25 August 2008 (UTC)
Meanwhile RussBot can use this query to check some soft redirected categories at a time:
http://en.wikipedia.org/w/api.php?action=query&prop=categoryinfo&titles=Category:Foo%7CCategory:Bar
That would still be much more efficient than actually visiting the category pages. And that query seems to work flawlessly.
--David Göthberg (talk) 21:15, 25 August 2008 (UTC)
I have talked to the MediaWiki API devs about the"generator + categoryinfo bug" above. Their answer was:
"This is really a symptom of a very different bug: categories that have a description page but never had any members aren't considered categories by the software. Filed at BugZilla. --Catrope 12:57, 26 August 2008 (UTC)"
That solves the problem in our case! Since if those categories never have had any members then we don't need their category info. Since we know they are empty. This means we can use these queries with confidence.
Our hard redirects:
http://en.wikipedia.org/w/api.php?action=query&generator=allpages&gapnamespace=14&gapfilterredir=redirects&gaplimit=500&prop=categoryinfo
Our soft redirects:
http://en.wikipedia.org/w/api.php?action=query&generator=categorymembers&gcmtitle=Category:Wikipedia_category_redirects&gcmnamespace=14&gcmlimit=500&prop=categoryinfo
(I know User:Russ already knows the rest, but for any one else wanting to use this.)
The hard redirects search can be used on any Wikimedia project, such as other language Wikipedias. Just change the server URL in the query.
Note that those queries only show the first 500 items. To get the next batch you need to use the "gapfrom=" and "gcmcontinue=" parameters. See "apfrom=" and "cmcontinue=" in the API help or at mw:API.
--David Göthberg (talk) 13:38, 26 August 2008 (UTC)
Experimentation so far has convinced me that the API approach is much more reliable than the conditional categorization method used on Commons. I'm going to do a little more testing and then roll this out on SVN. --Russ (talk) 21:06, 26 August 2008 (UTC)
Russ: I see from the SVN log you link to in the next section that your bot now uses those API calls. And I see you also used our advice on another talk page to have your bot do all the editprotected requests on a single page, and that seems to work fine. (Never mind that message you got on that page from one cranky admin about "pinging" an admin, he is always cranky like that. The editprotected request is exactly the "ping" supposed to be used in this case.)
And a status report on the test run that I started 22 August (19 days ago): The "deprecated" category has still not shown up in my "detection" category.
--David Göthberg (talk) 10:58, 10 September 2008 (UTC)

Soon obsolete?

After posting the last section, I saw that developer NicDumZ has written a new MediaWiki branch which, if accepted, would make the whole soft-redirect approach obsolete. See mw:User:NicDumZ/GSoC for how this will work. --Russ (talk) 20:10, 21 August 2008 (UTC)

Yeah, if/when they deploy that update it will be nice.
--David Göthberg (talk) 21:22, 21 August 2008 (UTC)
Now that I have studied this matter more, then it seems to me that even if they deploy this update then we still need something that takes care of pages that categorise into a redirected category. Sure, that system includes a feature to automatically take care of most of the cases. But in some cases the category name is concatenated inside some template code and thus the "automatic category link rename thingy" won't be able to fix it. So then we still need for instance the second API query I show in the previous section to find and manually fix those cases. That query also shows the empty categories, but it is easy to manually or automatically filter that list to pick out the categories with one or more items in.
I think the best way would probably be to have a "Special:" page that lists all redirected categories that still have pages and subcategories in them. That special page could perhaps be updated only once every 2 days or so to save load, and it could sort the categories with the ones with the most pages and subcategories in them first. Similar to how the Special:MostLinkedTemplates works. Such a special page would be of even more use if the new category redirect handling is not implemented. We could have good use of it already today. And smaller Wikipedias in other languages might not have any bots available to take care of such things, so they would really have use for such a "Special:" page.
--David Göthberg (talk) 19:04, 25 August 2008 (UTC)
The API is great. I used it before but always forget about it. (Probably because, at the time, I was tying to pick up a bit of php and got pretty frustrated with it). I just witnessed an event that demonstrated why this whole category redirect process can never be fully automated, especially for this project. See commons:User talk:Rocket000#Cities and villages in Spain. Rocket000 (talk) 19:55, 25 August 2008 (UTC)
BTW, I updated the template logic:
{{#ifeq:{{PAGESINCAT:{{PAGENAME}}}}|0||[[Category:Non-empty category redirects]]}}{{#ifeq:{{NAMESPACE}}|Category|{{#ifeq:{{PAGENAME}}|{{{1}}}|[[Category:Broken category redirects|*]]|{{#ifexist:Category:{{{1}}}|[[Category:Category redirects|{{PAGENAME}}]]|[[Category:Broken category redirects|**]]}}}}|[[Category:Broken category redirects|***]]}}
That reminds me, would you be interested in starting a template coding style guideline? Not a Wikipedia guideline, but a general page where we lay out some standard conventions for templates. There's some pretty complex ones out there and wikicode is not the easiest to read with all the {{{}}{{{}{{{}{}}}} crap. Everyone does the indentation/comments/whitespace differently and I usually have to learn a new style everytime I try to understand an elaborate template. I'm never sure myself how I should format them to make them easiest to read. Rocket000 (talk) 20:13, 25 August 2008 (UTC)
Yeah, if someone redirects a category wrongly then it gets messy when a bot or the system changes all the pages to categorise into the new category.
For other readers of this page: I think that the code Ricket000 shows is for his soft category redirect template on Commons.
Haha, are you messing with me on purpose? I had to properly indent your code above to be able to read it. Here is how I indent it:
{{#ifeq:{{PAGESINCAT:{{PAGENAME}}}}|0
|
| [[Category:Non-empty category redirects]]
}}{{#ifeq:{{NAMESPACE}}|Category
| {{#ifeq:{{PAGENAME}}|{{{1}}}
  | [[Category:Broken category redirects|*]]
  | {{#ifexist:Category:{{{1}}}
    | [[Category:Category redirects|{{PAGENAME}}]]
    | [[Category:Broken category redirects|**]]
    }}
  }}
| [[Category:Broken category redirects|***]]
}}
I see that you still rely on that the redirected category page gets re-rendered every now and then. And as I stated in the previous section I don't know if all such pages do get re-rendered since they might never be visited. (Unless there are search engine crawlers and spam crawlers that visits all our pages.)
And yeah, I have been thinking of starting some Wikipedia how-to guide about template programming to document the tricks and methods that I have learnt now. But that one would be a very large project and would have to consist of many pages. For starters it would probably be better to update and extend the Help: pages we already have about template programming. Most of them are very outdated, and very hard to understand. But I haven't had the time so far.
So before that I am thinking of making a how-to guide about namespace detection. See {{main talk other}} and its sister templates. That would be a much smaller job. I almost have a tradition of writing a how-to guide when I have made enough templates in one area. Since a single page that lists when to use which template is needed when they become a "family". It also gives a single talk page to use to discuss that issue. My how-to guide about line wrapping is such a page and has become pretty popular: Wikipedia:Line break handling
--David Göthberg (talk) 20:59, 25 August 2008 (UTC)
With the current category-redirect script (soon to be bot) I use now, it touches every page anyway. (Just to clarify for anyone else reading, I'm talking about Commons.) So until someone implements a better way, {{category redirect}} still needs to do some of the work.
Yeah, I intentionally didn't indent the above code. ;) Usually I use a similar indention style. Sometimes I put the "then" and "else" pipes at the end of the lines to get the brackets lined up:
{{#ifeq:{{NAMESPACE}}|Category|
  {{#ifeq:{{PAGENAME}}|{{{1}}}|
    [[Category:Broken category redirects|*]]|
    {{#ifexist:Category:{{{1}}}|
      [[Category:Category redirects|{{PAGENAME}}]]|
      [[Category:Broken category redirects|**]]
    }}
  }}|
  [[Category:Broken category redirects|***]]
}}
But I admit, it's not the most logical. Wikipedia:Line break handling is a very useful page. I also been thinking about starting a collection of pages for template tricks and tips. They wouldn't really be for masses, but for somewhat experienced template makers. There would be little explanation/background info and mostly demonstration (which also means less translation). I was going to work with the existing handbook pages on Meta. Most of their templates are solely for demonstration. I learned so many things over there (from Patrick, of course). Some of the pages get pretty advanced, e.g. m:Help:Recursive conversion of wikitext or m:Help:Parameter default. And there's so much good stuff hidden away on template talk pages. There's also many workarounds/hacks for various things (like overcoming the #ifexist limit or how to make cool things like this)... I guess this is pretty off-topic for this page. :) I think I'll go back to Commons and write something up about template code formatting. I'll drop you a link when if/when it's done. Rocket000 (talk) 01:54, 26 August 2008 (UTC)
Ah, did not know about that discussion, thanks goes to Davidgothberg for poking me on the matter.
I wish I could do magic, but there's no magic in my implementation of category redirects :) In other words, when you (mediawiki-)redirect category Authors to Writers :
  • When viewing Writers category page, Authors pages are listed too (good, that's what we want!)
  • When viewing Authors category page (&redirect=no), Authors are still listed (we don't really care)
  • But, and that might be your actual problem, when you view an Author' page, the Author is still listed in the Authors category and not in the Writers page: there no way to go through all the pages in the Authors category to just plainly change the category to Writers. The assertion Sure, that system includes a feature to automatically take care of most of the cases. But in some cases the category name is concatenated inside some template code and thus the "automatic category link rename thingy" won't be able to fix it. is wrong, there is no such feature, this is eventually not feasible, and I've been really naive to at first think of the contrary.
I believe in fact the category mechanism to be quite close to the soft redirect mechanism: if you do need to merge categories, you'll still have to ask a bot. However, if you only want the page to be included in the target category, not really caring about the name displayed at the bottom of the articles, that new category-redirect feature is meant for you.
I could also add two special pages, you're right. One for listing category redirects, and another one to list pages belonging to category redirects. Special:CategoryRedirects and Special:InCategoryRedirects ?
Was that comment useful ? :)
NicDumZ ~ 04:04, 26 August 2008 (UTC)
Thanks for popping in here NicDumZ. And your comment is very useful.
Based on your description I think your new category redirect system works exactly as it should. It will be a great improvement when it is deployed.
And right, there is no robust way to automatically fix the pages who categorise themselves into redirected categories, since category names might be hidden in complex template code and so on. So yeah, we still need a human controlled bot to go over and fix the easy cases, and humans to manually take care of the complex cases.
I would love if you make those special pages. They can be deployed and be very useful even before your new category redirect system is built. Actually, they would make your category redirect system a little less necessary! (But I still want your system.) And as I stated above, smaller Wikipedias in other languages that doesn't have bots would have even more use for it.
If we make the first special page work the right way then we really only need one. And I like your names for them. Here's how I would like Special:CategoryRedirects (the main one) to work:
1: To me it doesn't matter if it lists all redirected categories, as long as it lists those that are not empty. But there might be cases when people want to have the whole list, so why not. Currently on the English Wikipedia we have about 7000 redirected categories. (Counting both our current soft and hard redirects.)
2: To make it really useful it should sort the special page based on category "sizes". That is, the categories with the most pages/images/subcats in them should be listed first. And they should have a number next to them stating their "size", preferably with all three numbers: "pages, images, subcats".
3: The category links in the list should of course have "&redirect=no".
4: Since getting all the sizes for the list is probably a pretty database intensive operation I suggest that the special page is only updated once every 2 days.
Such a special page would make it easy to clear out one redirected category at a time. There are several benefits of being able to handle one category at a time. Like at the top of the list we probably will see pages that use a template that needs fixing, and thus with one edit to a template we might be able to fix a lot of pages at once. And when fixing redirects a human might need to check that the redirect is correct and in some cases pages should not just be changed to the new category but some should perhaps be categorised to another category instead. Thus working one redirected category at a time is easier.
Note that this shows that when we view a redirected category we do need to see what pages are in it. (In reference to your "we don't really care" comment above.)
And about your second special page Special:InCategoryRedirects, the one that would list all pages/images/subcategories that have categorised themselves into a redirected category. That is, all pages that need fixing. This would only be useful if the pages show redirected categories in a different colour at the bottom of the page. Since otherwise we would not know which category on a page would need fixing. But as I stated above, it would be better to work one category at a time instead. So I don't think we need the Special:InCategoryRedirects.
--David Göthberg (talk) 11:25, 26 August 2008 (UTC)

Category redirect bot

I have now posted the bot code used by RussBot to maintain category redirects. Please talk with me before running on this wiki, since I use the bot to gather statistics and this would be disrupted if other users run the bot at the same time. --Russ (talk) 12:29, 25 August 2008 (UTC)

Category redirects now work

See the discussion here. --R'n'B (call me Russ) 12:43, 19 February 2009 (UTC)

had to retrieve the archived discussion --kostmo (talk) 04:32, 10 October 2009 (UTC)

Currently working on a software solution?

The section "What this template is for" at the top of this page states: "MediaWiki developers are currently working on a software solution." Is there an item in Bugzilla about this, or is it no longer being worked on? --Damian Yerrick (talk | stalk) 22:07, 14 August 2009 (UTC)

Found it at T5311 --kostmo (talk) 04:39, 10 October 2009 (UTC)

Parameter change

A recent change to this template used a little template magic so that users could enter either {{category redirect|Category:Foo}} or {{category redirect|Foo}} on a redirect page and get the same result. Unfortunately, using the first format breaks the category redirect maintenance bot, which relies on the template parameter being the category name without the prefix. Fixing the bot is not as simple as it might seem, because Category:Category:Foo is a valid category page title in the MediaWiki software, and we can't just assume that there will never be a category using a name of this form. Accordingly, I have reverted the change to the template; this does not break any existing redirects, because the latest bot run identified all such instances (two or three) and I fixed them manually. --R'n'B (call me Russ) 20:04, 13 October 2009 (UTC)

Hard redirects

There's an RFC on using hard redirects instead of soft, see the proposal at WP:Hard category redirects ; the discussion occurs on the talk page. 70.29.209.91 (talk) 03:43, 31 October 2009 (UTC)

Special:UnusedCategories

I found in Special:UnusedCategories several category redirects. They are all in the form {{categoryredirect|...}} or {{category redirect|...}}. I did not find any {{Category redirect|...}}, are they filtered? Are admins able to fix Special:UnusedCategories in order to filter also the lower case syntax? Is a bot required? (I run a bot so I could ask for BRFA) -- Basilicofresco (msg) 15:26, 9 April 2010 (UTC)

You just didn't look hard enough.  :-) See, for example, Category:Unusual things, which has a capitalized {{Category redirect}}. Bottom line is, that Special page is pretty useless. You might want to request a database report that would exclude redirects. --R'n'B (call me Russ) 16:08, 9 April 2010 (UTC)

Edit request

{{Edit protected}}

Because of limitations in the software, a redirect with a link to a page will appear as a redirect to that page in the "What links here" page (e.g. "What links here" thinks Category:Shia Imams is a redirect to this template). Could some please remove the sentence "See instructions for more information."? Readers will be able to find more information by following the category link. McLerristarr | Mclay1 11:13, 4 December 2010 (UTC)

Not sure about this request. A "category redirect" is not a real redirect because articles placed in the redirected category will not appear in the target directory. Therefore a bot is used to change the categories over. I believe that it is not usual to actually redirect a category when using this template, because then the message won't be seen. I've updated Category:Shia Imams to this effect. Does this make sense? — Martin (MSGJ · talk) 12:16, 6 December 2010 (UTC)
I understand how category redirects work, but I now realise that the pages in "What links here" that are erroneously appearing as redirects to this template all appear to have the normal #REDIRECT mark-up in them as well as this template. This is causing them to register as normal redirect pages. A redirect page with a link to a page other than its target is erroneously thought of as a redirect to that page in "What links here". McLerristarr | Mclay1 15:12, 6 December 2010 (UTC)

Edit requested

Could the line

'''This category is located at <span id="SoftRedirect">[[:Category:{{{1}}}]]'''.</span>

be changed to read

'''This category is located at <span id="softredirect">[[:Category:{{{1}}}]]</span>.'''

? The code is badly nested, and the softredirect ID is in lowercase elsewhere. — This, that, and the other (talk) 06:15, 15 July 2011 (UTC)

 Y Done. Amalthea 08:57, 15 July 2011 (UTC)

Edit request to fix category suppression

I would like to add a "nocat" parameter, so that this template can be displayed on an instruction page like WP:TMCAT, without it auto-categorizing the page. Please see the sandbox. Thanks, --Funandtrvl (talk) 01:08, 20 July 2011 (UTC)

Made a couple of changes to the sandbox. Let me know if it looks okay. — Martin (MSGJ · talk) 10:25, 20 July 2011 (UTC)
Yes, it looks like it'll do the job. Thanks, --Funandtrvl (talk) 18:26, 20 July 2011 (UTC)
  deployed — Martin (MSGJ · talk) 07:30, 21 July 2011 (UTC)