Category pages
A "category page" is any page in the Category namespace. They each act as a category, and are termed a "category". The category page has one section titled Subcategories listing other "categories", and one section titled Pages, listing pages as categorized (in other namespaces). New categories are created by creating a page in the Category namespace.
A category page can be edited like any other page. However, when it is displayed, the editable part of the page is followed by automatically generated lists of pages belonging to the category, as follows:
- First a count and list of subcategories (other category pages belonging to the category) is shown, if any exist. The name of each subcategory is followed by a count of its own subcategories. These further subcategories are expanded in the display if the ► sign alongside the subcategory is clicked (but this "widget" is only visible if your browser has JavaScript enabled). Note: ► is shown if there are no further subcategories. The subcategory is collapsed again if ▼ is clicked.
- Next a count and list of pages in the category (excluding subcategories and images) is shown. If the category has no members, a message to that effect is displayed.
- Next a count and list of image and other media files in the category appears, if any exist. These are shown with thumbnails. 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.
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).
For the way in which the lists are ordered, see Sort order below. The first and second lists are divided into sections, according to the first character of the sort key. These initial characters are displayed above the sections. To suppress these, make all sort keys start with a space.
A category page can only display a limited number of items (currently 200). If more pages belong to the category, there will be a link to the next ones.
The categories box for the category page appears at the bottom, in the same place as for other pages. This contains the categories to which the current category page has been added, i.e. its parent categories (the categories of which it is a subcategory). Add a category page to other categories in the normal way, using the "[[Category:Category name]]" or "[[Category:Category name|Sortkey]]" syntax.
Linking to category pages
To link to a category page without putting the current page in that category, precede the link with a colon: [[:Category:Category name]]. Such a link can be piped like a normal wikilink. (The {{cl}} template, and others listed on its documentation page, may sometimes be helpful.)
Sort order
By default, a page is sorted under the first letter of its full name including the namespace. English Wikipedia groups accented characters together with their unaccented version, so pages starting with À, Á, Ä, will be listed under heading A. Sorting is case-insensitive, so "ABC" comes after "Abacus".
Unlike at Special:Allpages and Special:Prefixindex, a space is treated as a space (coming before all other characters), not as an underscore.
The English Wikipedia has numerical sorting in categories. This means a page whose title begins with a number will be sorted according to the numeric value of the number (even if it is multiple digits). Thus "9 dogs", "25 dogs", and "112 dogs" will all appear under the "0–9" heading in numeric order. If the number includes a comma, space, or period, the sorting algorithm will only consider the part of the number before the separator.
Each of the three lists (subcategories, pages, media files) is arranged in the order explained above (except that, in the subcategories list, the namespace indicator "Category:" is not considered). If an item ought to be positioned within a list on the basis of an alternative name (sort key) for that item, then this can be specified in the category tag that places the item in the list:
[[Category:Category name|Sortkey]]
For example, to add an article called Albert Einstein to the category "People" and have the article sorted by "Einstein, Albert", you would type:
[[Category:People|Einstein, Albert]]
Unlike with a piped link (which uses the same syntax), the sort key itself is not displayed to readers. It affects only the order in which pages are listed on the category page.
It is useful to document the system being used for sort keys on the category page. For guidelines about the use of sort keys on Wikipedia, see WP:SORTKEY.
Default sort key
See also: WP:NAMESORT and WP:SORTKEY
It is possible to set a default sort key which is different from {{PAGENAME}}
by using the magic word {{DEFAULTSORT}}
:
{{DEFAULTSORT:new key}}
In the case of multiple default sort key tags, the last DEFAULTSORT on the final rendering of a page applies for all categories, regardless of the position of the category tags. This also means that a DEFAULTSORT tag included from a template is not effective if another DEFAULTSORT tag occurs later on the page, even if the later DEFAULTSORT tag is also "hidden" (included by another template).
Hiding categories
When the magic word __HIDDENCAT__
is placed on a category page, that category becomes hidden, meaning that it will not be displayed on the pages belonging to that category. On Wikipedia, the magic word is not normally used explicitly, but is applied through the {{hiddencat}} template. The feature is mostly used to prevent project maintenance categories from showing up to ordinary readers on article pages.
However, hidden categories are displayed (although listed as hidden):
- on category pages (whether as parent categories or subcategories);
- at preview during editing;
- if the user has selected "Show hidden categories" in user preferences.
Hidden categories are automatically added to Category:Hidden categories.
For guidelines on the hiding of categories on Wikipedia, see WP:HIDDENCAT.