User:Adamw/Delete: Category alias proposal

This page describes technological alternatives for a category aliasing feature.

Problem statement
In some cases it's necessary to render category labels differently depending on the subject of an article. For example, in German Wikipedia any article about an Ärztin (woman doctor) displays category "Arzt" which is marginally grammatical and can be improved by using the correctly gendered title. In English Wikipedia, a British "theatre director" and American "theater director" could be categorized under the spelling variant the subjects would use for themselves, only this one title should appear on the article, but both country's directors should appear on a single category's list.

Current work
A 2017 survey of German Wikipedians identified this as a priority to fix. The Wikimedia Deutschland Technical Wishes team is hoping to solve this problem in 2020, with a technical mechanism to allow for category aliasing. Aliases will have specific behaviors still to be discussed, but the general idea is that an aliased category label will appear in the list of categories at the bottom of an article, but canonically indexed under another category.

Soft redirect categories
Categories are only ever soft-redirected to one another. In English Wikipedia, this is accomplished with the  template, which has semantics like HTTP's "301 Moved permanently", and is helpful for common typos such as "Category:Stub" when "Category:Stubs" was intended. A soft-redirected category should never be used on an article, but when this does happen a bot can fix the article to use the target category instead. Soft-redirect category pages themselves remain indefinitely, or until they are no longer needed.

Hard redirects are broken
At first glance there should be two ways to redirect a category, like any other wiki page: either with a soft redirect template or by the hard-redirect " " directive in wikitext. Unfortunately, a hard redirect is never correct and a bot will convert the hard redirect category to a soft redirect. This is "because of the software's inability to recategorize pages from redirected categories". An article page using the redirect category will be a member of the alias but not the target category, so nothing is gained by using the redirect. At the same time, visiting the alias category page results in a browser redirect to the target category (unless the magical  was included), which does not include the article. This is a bad user experience.

Existing bots will rewrite any hard redirected categories as a templated soft redirect, using the "Category redirect" template, for example with this edit.

Proposal
We can change the behavior of hard-redirected category pages, so that the linking article is categorized under the redirect target category. If an article is categorized with, and the "Category:Theater director" page contains the source " ", then the biographical article will display the "Theater director" category, but will show up on the "Category:Theatre directors" page.

Prior work
A similar idea for category redirects has been around since at least 2009, when a similar feature was temporarily deployed. The implementation was incomplete and quickly reverted, but onwiki discussion was generally positive, and focused on fixing the edge cases rather than reaching consensus to disable. The revert was for technical reasons, the feature had not been completely specified and the code was no more than a proof of concept.

Non-page representations
It might be possible to implement category aliases in some other way which doesn't involve the creation of a category page for the alias. For example, category links could accept parameters a la the  tag, or the main category page could include information that is used to track and apply aliases.

So far, any representations of category aliases which don't include a full category page for the alias seem to quickly multiply our technical debt. We'll have to modify the many places where MediaWiki code interacts with categories, e.g. making the aliases available in search and autocomplete features.