Help:Category

Categories are a way of organizing pages on. They can be used to link articles under a common topic and help users quickly find the pages they're looking for. Categories will appear at the bottom of the page, where they will link to their respective category pages. A category page will list all pages that have been added to that category. All pages on the wiki should ideally be in at least one category.

The name "category" can be used to refer both to the category page (which can contain text like any other wiki page) and to the category itself.

Using categories
The categories a page belongs to will be listed at the bottom of the page. They will appear in a box that says "Categories", and will list the categories the page is in horizontally. If the page is not in any categories, this box will not appear.

To add a page to a category, simply edit the page and add  to the page. Although categories can technically be placed anywhere on the page, in practice they should be added to the very bottom of the page, just so it is easier to find later on. To remove a category, edit the page and then remove  from the page.

Category pages
Category pages belong in the category namespace; in other words, their titles will always start with Category: (note the colon). Pages in this namespace can be edited like any other page on the wiki, but have a few special properties. Category pages will display a list of pages that have been added to the category at the bottom. This list is automatically generated by the wiki software, and will typically display the list of members in alphabetical order.

[[File:Category British computer scientists with markers.png|thumb|center|700px|An example of a category page from the English Wikipedia. They contain three parts:

1. Category page text. This part can be edited like any other page.

2. Subcategories. This part is automatically generated, and cannot be edited. It lists all categories that are categorized under this category.

3. Pages in category. This part is also automatically generated. It lists all pages that are categorized under this category.]]

Category pages can be added to categories too. They are added in the same way regular pages are added to categories. Category pages are usually added to other categories in order to form a "Category hierarchy", where higher-level categories contain very broad and general subjects, and gradually narrow down to more specific names. An example of a category hierarchy could include:

A category and category page are technically two different things. You can add a page to any category of any name, even if the category page for that category hasn't been created yet. For example, if one were to add  to a page, the page will be categorized into the "XYZ" category, but unless someone creates the page "Category:XYZ", the category page will not exist, and links to it will be colored red. Clicking on the red link will give you the option to create the category page; however, all of the pages that were added to that category will still be shown at the bottom of the category page, so technically a category page is not required for a category to work. Similarly, creating or editing a category page does not add any pages to that category; to add a page to a category, you must edit that page directly, not edit the category page.

Linking to a category page
You can't link to a category page by adding  to a page; doing so adds the page to the category instead, and nothing will appear in the spot where you added the link. To link to a category page and not add the page to the category, you need to prefix the link with a colon. For example,  will create a regular link to the page "Category:XYZ", rather than adding the page to the "XYZ" category. Like any other link, you can change the text that is displayed by typing.

Redirecting category pages
Category pages can be redirected to another page. Like links to category pages, the link needs to be prefixed with a colon in order to stop the redirect from being categorized under that category. For example,.

Category redirects should be used with caution, as only the category page gets redirected. If you redirect the category page for ABC to XYZ, any pages that are still categorized under ABC will not be automatically categorized in XYZ. You will need to go to every page categorized under ABC and edit each one of them to be categorized under XYZ.

Sort keys
By default, pages in a category are sorted in alphabetical order by the first letter in their title, excluding the namespace prefix. Page sorting is not case sensitive, and accented characters are sorted separately from their unaccented versions. So for example, pages starting with À, Á, and Ä will be listed under different headings than pages that start with a regular A.

You can change how pages are sorted by adding a sort key to the page in order to make it get sorted differently. The easiest way to do this is to add a pipe character to the category link, followed by what you want the page to be sorted as. For example,  will cause the page to be categorized into XYZ as normal, but will be sorted as if its page title was ABC, so it would be listed under the "A" heading on the category page.

Note that adding sort keys does not affect how the category displays on the page it is added to. If you add  to a page, the category will still appear as XYZ at the bottom of the page.

Default sorting
While the above method works for individual categories, sometimes you want a page to automatically be sorted by a sort key for all categories that it is in. You can use the  magic word to accomplish this. For example,  will cause the page to be sorted as if its page title was ABC in all categories that it is in. Note that manually setting sort keys for an individual category will override the default sort key.

If multiple  are used, the last one used on the page will take precedence over all the others, and an error message will be displayed. You can suppress the error message by adding  to the magic word (e.g.  ), or have the sort key ignored if there is an existing one on the page by adding   (e.g.  ).

Hidden categories
A hidden category does not appear at the bottom of the page when it is added. Hidden categories are usually used for maintenance or for tracking purposes. For example, if a template on a page is being used incorrectly, it can add the page to a hidden category to help editors find the problem later on.

You can see the hidden categories a page belongs to by going into your preferences, selecting the  tab, and then selecting . You can also view them by editing the page and then scrolling to the very bottom of the edit window.

Categories can be marked as hidden by editing the category page and then adding the  magic word anywhere on the page.

All hidden categories are listed in Category:.

Tracking categories
A tracking category is a category that is automatically added by the wiki software when it detects that a page has a certain characteristic. For example, a page that contains a link to a file that does not exist will be automatically added by the software to Category:.

A full list of tracking categories can be found at Special:TrackingCategories.

Why aren't pages appearing in a category?
Sometimes, categories are added by templates and not by adding  directly to the page. When this happens, the category may appear to have been added at the bottom of the page, but the category page may not list the page yet because of server caching. The solution is to do a null edit on the page where the category has been added to. The category page should then update and list the page.