From Wikimedia Commons, the free media repository
Jump to navigation Jump to search

This is a functional specification for a pywikipediabot. Filnik is working on it.


Wikimedia Commons is all about images. To find images, metadata has to be added. Categories are a very important part of the metadata. One of the problems with categories is that although they can be redirected to another category, this does not mean that the content of the source category is moved to the redirect target. Worse even, content that ends up in a redirected category disappears, as users will always end up in the redirect target where in small text the name of the redirected category is shown.

One of the solutions that has been used on Commons is the template {{Category redirect}} (also {{seecat}}). It serves as a soft redirect. This template routes a user to the redirect target, so that the content stays visible. A drawback is that a user needs more clicks to get to the content he wants to see.

Both methods (hard redirection/soft redirection) have their drawbacks. A bot may a provide a solution to some of these issues. Ideally {{Category redirect}} will no longer be used, as the bot will take care of recategorising media that have been placed in a category containing {{Category redirect}} or a redirected category. {{Category redirect}} should be phased out and category redirection can be used as easily as redirection in the main namespace.

Functional specifications[edit]


  1. The bot should be written in pywikipediabot (python)
  2. The bot should be licensed with the same license as pywikipediabot (MIT) so it can be added to the bot framework


The bot has the following tasks:

  1. Recategorise objects inside objects inside namespace Category: on which the templates {{Category redirect|target}} and {{seecat|target}} have been placed to Category target, obiding below condition(s)
  2. Recategorise objects inside objects inside namespace Category which have been redirected to another object inside namespace Category, obiding below condition(s)
  3. Replace a page in the namespace Category containing a soft redirect with a hard redirect and add the category page to Category:Hash mark redirected categories
  4. Report the Categories (using redirect=no) where the below condition(s) have not been met, so manual review can be done at Commons:Redirected categories with content. Categories that are already on Commons:Redirected categories with content, should not be reported again. A sub heading should be created for each bot run.


  1. For actual recategorisation to be performed, a Commons administrator must have made the last edit to the page in the namespace Category. This is to prevent that a vandal (soft) redirects a few important categories for which the objects are moved without checking.
  2. A 'trusted user list at Commons:CategoryRedirectBot/CheckPage should be supported. This is a bulleted list containg a specified link to a user page.

Edit summaries[edit]

Running the bot[edit]

The bot should be run at least once every week, preferably daily, depending on run time and resource usage. To run, a user does not have to be a Commons admin. Any admin can take care of the list on Commons:Redirected categories with content.


Currently we have two implementations (not exactly following the functional specifications). Both implementations implement a cooldown period of a week to prevent vandalism.

Both SieBot and RussBot run on a regular basis to keep Category:Non-empty category redirects clean.