Flattening MediaWiki's categories

, Perth City Library.

I've long felt that MediaWiki categories introduce too much confusion. In most wikis they're thought of as a hierarchy, but actually the software just structures them as a directed graph. So lately I've been tinkering with the idea that instead of categories being linked together at all they could be thought of as 'tags' or keywords. This would mean that they would not have any sort of structure to themselves beyond a name and a description (the latter being just the contents of the category page).

Because categories never seem to be detailed enough—or they're too detailed. For example, say you have a set of pages describing the working habits of novelists: who they were, where and how they worked, that sort of thing. So there would be categories about the people ('Australian', 'Female', 'Born in 1883', 'Deceased'), their working environment ('Urban', 'Rural', 'Wrote in longhand', 'Refused to have a radio in the house'), and their work ('Fantasy', 'Pastoral', 'Boring'). How is one to get a list of male novelists who wrote crime-fiction on a typewriter? The various cross-sections of the categories can never be fully defined and even trying to do the more popular intersections is tedious and full of redundancy.


I'm working on a little extension that chucks all this away, and instead works on the idea that each page has a set of categories (as is currently the case) and that's all; there are no parent categories. So, it becomes simple to produce a list of any given category, as well as any category intersection (or complement).

The extension provides a special page, Special:FlatCats, which initially presents a list of all (or the top n) categories and displays no pages. Each category has a plus and a minus icon next to it, which the user selects in order to include or exclude that category from the list of displayed pages. When a category has been selected, the category list is reduced to only include those categories that are referenced by at least one page in the current set (or exclude all that are referenced, in the case of negative selection).

So it is easy to select all female non-Australian novelists with something like: [+Female -Australian +Novelist].

The other part of the extension is to automatically include the selection part of this searching interface at the top of Category pages, so that navigating to a category not only provides the normal list of pages in that category but also gives an easy way to view related lists of pages (i.e. what would currently be thought of as subcategories).

Retrieved from ‘https://samwilson.id.au/index.php?title=Flattening_MediaWiki%27s_categories&oldid=524