User:Adamw/Delete: Category alias proposal

This page describes some potential technical implementations for category aliasing.

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 ungrammatical. Incorrect category labels using the generic masculine also diminish the visibility of women in many fields.

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. A made-up English equivalent would be that a biographical article about a

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 happens a bot can fix the article to use the redirect's 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 " " wikitext directive. Unfortunately, a hard redirect is never correct and a bot will convert the hard redirect 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 and not the target category, but visiting the alias category page results in a browser redirect unless the magical  was included. 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
I'm proposing that we change the behavior of hard-redirected category pages, so that the linking article is categorized under the redirect's target category. If an article is categorized with, and the "Category:Firewoman" page contains the source " ", then the biographical article will display the "Firewoman" category, but will show up on the Firefighter category page.

An optional extra behavior would be that the article also show up on the "Category:Firewoman" redirect page since this will be helpful for finding all members of an alias, but this is a UX question, because the hard redirect also means that it will take an extra URL parameter to reach the Firewoman category 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 a consensus to disable.

Alias keyword
Rather than change the behavior of " ", we might introduce a new directive such as " " instead. Although this is nice because it gives us additional freedom to add constraints and behaviors, it means a wikitext syntax change, which could confuse parsers, etc.

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.