Help:Category

Categories provide automatic indexes, that are useful as table of contents. Together with links and templates they structure a project.

Putting an item in a category
A page in any namespace can be put in a category by adding a category tag to the page (by convention, at the end of the page), e.g.:

Category:Category name

This lists the page on the appropriate category page automatically and also provides a link at the bottom of the page to the category page, which is in the namespace "Category". Pages can be included in more than one category by adding multiple category tags. These links do not appear at the location where you inserted the tag, but at the page margin in a fixed place, depending on the skin (the bottom for Monobook, the upper right corner for Standard). Category tags may be placed anywhere in the article, although they are typically added to the end of the article to avoid undesirable text display side effects. Category links are displayed in the order they occur in the article, unlike the automatic ordering of lists in the category pages themselves (see below).

Putting an image in a category is equivalent to putting the image page in it.

A category page itself typically has an editable part, containing at least a category tag of a supercategory, see below; if it does not, the link to the category page is treated as a link to a nonexisting page; hence, it is a link to the edit page.

Subcategories
Creating subcategories takes only a few additional steps. Adding a category tag to a category page makes the edited category a subcategory of the category specified in the tag.

First create a new category page for the subcategory the same way you would make a regular category. For example, create.

Then go to the newly created category page and edit it. Add the category tag for the parent category (e.g. ) to the page.

In this example, the Jokes category would then be a subcategory of the Miscellaneous category. For a live example see Category:Demo_1 which is a subcategory of Category:Demo.

Category description pages
A category page consists of:
 * editable text
 * list of subcategories; how many there are is also displayed; if there are no subcategories the header and count are not shown.
 * list of pages in the category, excluding subcategories and images; the number of items in this list is called the number of articles; if there are none the header is shown anyway, and "There are 0 articles in this category."
 * list of images with thumbnails (how many there are is not counted); the first 20 characters of the image name are shown, with an ellipsis if that is not the full name; also the file size is shown. As opposed to the second and third section, this section does not have subheaders per letter, it has not even a header itself and visually seems to fall under the header of the previous section "Articles in category ...", even though in counting the articles, images/image pages are not considered articles).

To create a category page, you must add a colon in front of the Category tag when you set up the page-creation link, to prevent the software from thinking you merely want to add the page you are working from to the category:



Placing the above text on working page will create the link you can use to edit your category page.

The items in the lists all link to the pages concerned; in the case of the images this applies both to the image itself and to the text below it (the name of the image).

The first and second list each have a header for each first character, dispensed with if there are no entries for a header.

A redirect to a category shows the editable text only. To get the full page after being redirected, use the link "Image", or "Category", respectively.

Comparison with "What links here"
Backlinks are often used as a by-product of links. However, links can be put specially for the backlinks, just like category tags are. In that case a redirect corresponds to a supercategory.

Advantages of categories:
 * Category listings are alphabetical, for "What links here" this typically applies for the first part only, for the pages already linking to the given page at the time of the last rebuilding of the link tables in the database.
 * Categories have an editable part (however, there is anyway a talk page)
 * A category can have multiple supercategories

Advantage of a pseudo-category system using backlinks:
 * Backlinks can show a tree structure: not only pages and subcategories, but also the contents of the subcategories (for each a list of pages and a list of sub-subcategories) and the contents of the sub-subcategories (for each a list of pages and a list of sub-sub-subcategories), but not the contents of the sub-sub-subcategories, up to three levels are shown; see Cat:Help.

Alternatively a template (either a dummy one, specially for this purpose, or one with contents) can function as a supercategory, used in connection with backlinks. In that case:
 * also multiple supercategories are possible
 * combined content of subcategories is shown in one list, not grouped by subcategory (the tree structure is not shown, but it can be used by taking the backlinks at a lower node, showing the smaller set)
 * the restriction of three levels (in the case of using redirects) does not apply; for example page Aijkl in the category Aijk in the category Aij in the category Ai in the category A (represented by Aijkl calling template Aijk, etc.) can be shown in the list of pages in category A (the backlinks of template A).

"What links here" tends to be a by-product of links that are useful anyway (although links may be put with this use in mind), while category links are put specially to produce a category page.

Putting a category tag on a test page, user page, etc. (also if done indirectly by including a template with a category tag) is considered to pollute the category, while regular links from such pages showing up in "what links here" is considered harmless.

Therefore:
 * when copying text to such pages, category tags have to be removed; alternatively, convert the category to a link by adding a leading colon after the brackets. For example, "Category:Graphics" is a link to the category, not an assignment to a category.
 * when including a template that is in a category, do not use the template feature, but use "subst" or copy-and-paste, and delete the category tags.

Applying "What links here" and "Related Changes" to a category
For the "What links here" feature, only the links in the editable part of the page count, not the links to the pages in the category.

For a category, the "Related Changes" feature gives the changes in the pages in the category (according to the current category page, so excluding the pages that have potentially been added and including those that have potentially been removed, through addition or deletion of a template to/from the category, as explained above)
 * for subcategories: the changes in their editable parts only
 * for images (image pages): the changes in their editable parts only.

It does not show the changes in pages linked from the editable parts of the category. Possible workarounds:
 * The editable part can be put in a template. The category tags (which have no effect on Related Changes anyway) can better be kept out of the template, because on the pages of these supercategories the template would be listed under the articles in those categories. Whether interwiki links (with or without interlanguage link feature) are in the template or not does not make a difference, provided that the template is not used elsewhere.
 * Related Changes is applied to a page that calls the category as a template: ; only the editable part is included in the page; the page could be specially created for this purpose and call multiple categories. However, this page will then be listed in the supercategory pages of each category.

As usual (but as opposed to a watchlist) the changes in the corresponding talk pages are not shown.

Detection of additions to a category
With "Related Changes" one can find pages which are newly in a category due to addition of a category tag or the tag of a template that is in the category. Addition of pages through addition to the category of a template is seen indirectly: one can see the change in the template, and then check which pages call the template. This even shows pages which are only potentially in the category (see above).

Detection of deletions from a category
Unfortunately there is no similar way to detect a deletion from a category.

Conventions about the use of categories
Each page is typically in at least one category. It can be in more, but it may be wise not to put a page in a category and also in a more general category.

Each category, except one top-level category, is typically in at least one higher level category.

Check the conventions in Clean City and make yourself familiar with the categories in use before assigning pages and subcategories to categories and before creating new categories.

For category names the usual rules for case-sensitivity of page names apply. So be aware that you create a new category if the capitalization is not the same.

How categories are implemented
(partly repeating the above)

Each of the pages in the Category namespace represents a so-called category, a kind of grouping of related pages.

When a page (in any namespace) belongs to one or more categories, this information appears at the bottom of the page (or in the upper-right corner, depending on the skin being used). For example, this page belongs to "Category:Help".

In such a category`s own page, on the other hand, an automatically generated, alphabetical list of all pages belonging to that category is displayed at the bottom (in fact ASCII order, see Help:Special page). Above that list, the category page contains text that can be edited, and new categories can be created as well, like any other regular page.

For a complete list of categories, see the Category index.

You can assign a category to a page simply by adding " Category:categoryname" to the page's wikitext source. Substitute the actual name of the category in place of categoryname.

To be specific, in order to add an article called "Tic Tac Toe" to the category "Games", you would edit the article and add " Category:Games" (no quotes) into its page source somewhere. Exactly where doesn't matter, but the Clean City policy, for example, is to put it after the article text, but before any interlanguage links.

-- to do -- 

Metawiki help on categories - understandable introduction and in-depth information as well.