Jump to bottom

Help:Category

From Wikipedia, the free encyclopedia

Jump to: navigation, search

This is a copy of the master help page at Meta. Do not edit this copy.

Edits will be lost in the next update from the master page. See below for more information.


Shortcut:
WP:CAT

For guidelines on creating and organizing categories, see Wikipedia:Categorization. For answers to frequently asked questions about categories, see Wikipedia:Categorisation FAQ.

A category is a software feature of MediaWiki. Categories provide automatic indexes that are useful as tables of contents. Together with links and templates they structure a project.

Summary

Each of the pages in the Category namespace represents a so-called category, a kind of grouping of related pages. For example, this page belongs to "Category:Editor handbook". When a page 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).

The page of the category contains text that can be edited, like any other page, but when displaying the page, the last part of what is displayed is an automatically generated, alphabetical list of all pages in that category, in the form of links (in fact ASCII order, see Help:Special page). "Existence" of a category has two independent aspects: the category can obtain one or more pages and/or the category page can exist as an editable page. New categories can be created in the last sense, and edited, in the same way as any other regular page. For a list of categories in this sense, see Special:Allpages/Category: (note the colon at the end). For a list of categories in the first sense, see Special:Categories.

You can assign a category to a page simply by adding "[[Category:Category name]]" to the page's wikitext source. In order to reference a category within a page as a normal wiki link (without adding the page to the category) prefix the link name with a colon. For example: [[:Category:Not in this category]]

For a complete list of categories, see Special:Categories. Individual wikis may have their own top-level categories, such as w:Category:Contents in Wikipedia. For categories in Meta-Wiki, see m:Meta:Categories.

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]]

Substitute the actual name of the category in place of Category name. To be specific, in order to add an article called "Albert Einstein" to the category "People", you would edit the article and add "[[Category:People]]" (no quotes) into its page source somewhere.

This lists the page on the appropriate category page automatically and also provides a link at 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. At Wikipedia, its policy provides that it should be put after the article text, but before any interlanguage links.

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).

Hidden categories

When __HIDDENCAT__ is put on a category page, that category is not listed on pages thus categorised. See category:hidden category demo and hidden category demo for an example. However, hidden categories can be made visible by ticking the item Show hidden categories (described by message with id 'tog-showhiddencats' (talk)) in the "Misc" section in the user's preference ; either way they can be made visible or invisible through CSS(details needed).

The hidden categories that a page belongs to are listed using the label supplied by the message with id 'hiddencategories' (talk) when editing the page.

Hidden categories are automatically added to the category specified by the message with id 'hidden-category-category' (talk). In this wiki it is Category:Hidden categories. Within the Category namespace, the hidden categories a category page belongs to are listed separately from the standard (non-hidden) categories it also belongs to, using the label specified by the message with id 'hidden-categories' (talk). [See category:hidden category demo 1.]

For example, suppose a page is categorised under MyHiddenCategory. The page itself does not mention this categorisation unless tog-showhiddencats is true, in which case the listing hiddencategories appears below the standard Categories listing (the specific positioning depends on the skin, obviously). Within the Category namespace, MyHiddenCat is listed under the hidden-category-category global category. If MyHiddenCat has sub-categories, these will each list MyHiddenCat under the hidden-categories listing, appearing below the standard category listing. If MyHiddenCat is itself categorised under some higher category, the latter lists it without making any particular distinction (that is to say, hidden sub-categories are listed just as if they were standard sub-categories).

Category page

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. With the Category Tree extension, installed on Wikimedia, one can click "+" to see the subcategories of a selected subcategory.
  • 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 image and other media files with thumbnails; the number of files is given and the first 20 characters of the file 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 sub-headers per letter.

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. If no headers are desired, use sort keys all starting with a blank space (see also below).

The number of items in each list is shown at the top of each.

On Meta and Wikipedia 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.

On Commons a redirect to a category gives the full page, but not the subcategories and pages in the redirect page (if that is also a category).

Creating a category page

To create a category page, one can e.g:

  • follow an automatically created link to the category page. Putting this code on any page creates the link.
[[Category:Category name]]

or:

  • 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 on to the category:
[[:Category:Category name]]

Placing the above text on working page will create the link you can use to edit your category page, and will display the link text as a normal wiki link without adding the page to the category.

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 [[Category:England]]

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

Then create a new page with a category link to England. In this example, the England category would then be a subcategory of the Country category.

e.g. adding link to the new page like this...

[[Category:England]]

Now to create a subcategory to subcategory England you need to create a new page with a category link to England wikipage and edit it (the category).

e.g. adding link to the page like this...

[[Category:London]]

For a live example see Category:Demo_1 which is a subcategory of Category:Demo.

Sort order

The system uses alphabetical order, or more precisely Unicode order, for pages in categories. The range 32–127 corresponds to ASCII, for more see a table of Unicode characters:

 !"#$%&'()*+,-./0123456789:;<=>?
@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_
'abcdefghijklmnopqrstuvwxyz{|}~

Note in particular that "Z" comes before "a", and "z" before accented / umlauted characters.

Although in Special:Allpages and Special:Prefixindex a blank space within a page name is treated as an underscore, and therefore comes after the capitals, and before the lower case letters, this does not apply in category pages: there a space counts as space. Compare the order of Help:Demo1 and Help:Demo a (both without a specified sort key) on Category:Demo and [1].

See also special characters, Pages starting with a special character, collating.

Sort key

Each of the three lists is in the order explained above. If you want an item in a list to be positioned in that order, based on an alternative name (sort key) for that item, then this can be specified in the category tag that places the item in the list: