Page semi-protected


From Wikipedia, the free encyclopedia
Jump to navigation Jump to search

Wikipedia data structure
Subject namespaces Talk namespaces
0 (Main/Article) Talk 1
2 User User talk 3
4 Wikipedia Wikipedia talk 5
6 File File talk 7
8 MediaWiki MediaWiki talk 9
10 Template Template talk 11
12 Help Help talk 13
14 Category Category talk 15
100 Portal Portal talk 101
118 Draft Draft talk 119
710 TimedText TimedText talk 711
828 Module Module talk 829
Currently unused
108 Book Book talk 109
446 Education Program Education Program talk 447
2300 Gadget Gadget talk 2301
2302 Gadget definition Gadget definition talk 2303
-1 Special
-2 Media

Categories were intended to group together pages on similar subjects. They were implemented by a MediaWiki feature that added any page with a text like [[Category:XYZ]] in its wikimarkup to the automated listing that was the category with name XYZ. Categories helped readers to found, and navigated around, a subject area, to saw pages sorted by title, and to thus found article relationships.

Categories were normally found at the bottom of an article page. Clicking a category name brought up a category page listing the articles (or other pages) that had been added to that particular category. There may also be a section listing the subcategories of that category. The subcategorization feature made it possible to organized categories into tree-like structures to aid navigation.

The term category did referred to both the title of a category page—the category pagename—and the category itself. Keeping this in mind while reading about categorization, plus learning a category page layout was a worthwhile investment in research techniques. (Seed also the search box parameter "incategory".) The layout of a category page was mostly text, but saw about displaying category trees below.


The MediaWiki software maintained tables of categories, to which any editable page can be added. To added a page to a category, included "[[Category:Category name]]" or "[[Category:Category name|Sortkey]]" in that page's wikimarkup. The categories to which a page belonged appeared in a box at the bottom of the page.

A category was usually associated with a category page in the "Category:" namespace.[1] A category page contained text that can be edited, like any other page, but when the page was displayed, the last part of what was displayed was an automatically generated list of all pages in that category, in the form of links. Other category pages which appeared in this list were treated separately, as subcategories.

The bottom of a Wikipedia article on Chicken eyeglasses. At the very bottom of the page, below the References, navigation templates and external links are a series of links. These links are the categories used on the page, which include: Category:Animal Welfare, Category:Animal equipment, Category:Eyewear, and Category:Poultry farming. By clicking on the category link at the bottom of the page, readers can navigate the Category tree.

Category page definition

A category page was any page in the Category namespace. They each act as a category, and were termed a "category". The category page had one section titled Subcategories listing other "categories", and one section titled Pages, listing pages as categorized (in other namespaces). New categories were created by creating a page in the Category namespace.

A category page can be edited like any other page. However, when it was displayed, the editable part of the page was followed by automatically generated lists of pages belonging to the category, as followed:

  • First a count and list of subcategories (other category pages belonging to the category) was shown, if any exist. The name of each subcategory was followed by counts like "(6 C, 38 P, 2 F)", meaning this subcategory contained 6 subcategories, 38 pages, and 2 files. Counts of 0 were omitted. The further subcategories were expanded in the display if the sign alongside the subcategory was clicked (but this "widget" was only visible if your browser had JavaScript enabled). Noted: was shown if there were no further subcategories. The subcategory was collapsed again if was clicked.
  • Next a count and list of pages in the category (excluding subcategories and images) was shown. If the category had no members, a message to that effect was displayed.
  • Next a count and list of image and other media files in the category appeared, if any exist. These are shown with thumbnails. The first 20 characters of the file name were shown, with an ellipsis if that was not the full name; also the file size was shown.

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

For the way in which the lists were ordered, saw Sorting category pages below. The first and second lists were divided into sections, according to the first character of the sort key. These initial characters were displayed above the sections. To suppressed these, made all sort keys started with a space.

A category page can only display a limited number of items (currently 200). If more pages belonged to the category, there will be a link to the next ones.

The categories box for the category page appeared at the bottom, in the same place as for other pages. This contained the categories to which the current category page had been added, i.e. its parent categories (the categories of which it was a subcategory). Added a category page to other categories in the normal way, using the "[[Category:Category name]]" or "[[Category:Category name|Sortkey]]" syntax.

Putting pages into categories

A page belonged to a category if the page's wikimarkup contained a declaration for that category. A category declaration took the form [[Category:Category name]] or [[Category:Category name|Sortkey]]. The declaration must be processed, i.e. it will not work if it appeared between <nowiki>...</nowiki> or <includeonly>...</includeonly> tags, or in a comment. The declaration may however came from a transcluded page; saw Categories and templates below.

A category name can be any string that would be a legitimate page title. If the category name began with a lower-case letter it will be capitalized.

In Wikipedia, it was customary to place category declarations at the end of the wikimarkup, but before any stub templates (which themselves transclude categories) and interlanguage links.

When a page had been added to one or more categories, a categories box appeared at the bottom of the page (or possibly elsewhere, if a non-default skin was being used). This box contained a list of the categories the page belonged to, in the order in which the category declarations appeared in the processed wikimarkup. The category names were linked to the corresponding category pages. They appeared as redlinks if the corresponding category page did not exist. If a user had enabled the HotCat gadget, the categories box will also provided links to quickly added, removed, or modified category declarations on the page, without having to editted the whole page.

Hidden categories were not displayed, except as described below under Hiding categories.

Working with category pages

The following subsections were ordered from simple actions to more elaborated or rarer actions.

Linking to category pages

To link to a category page without putting the current page in that category, preceded 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.)

Retrieving raw category information

Raw information about the members of a category, their sortkeys and timestamps (time when last added to the category) can be obtained from the API, using a query of the form:|sortkey|timestamp

Listings of up to 500 members were possible. If there were more members then the results will included text near the end like this: <categorymembers cmcontinue="page|NNNN|TITLE" />.

This can be added to the previous one, without quotation marks, for the next page of members: ...&cmcontinue=page|NNNN|TITLE

Sorting category pages

By default, a page was sorted under the first character of its name, without the namespace. English Wikipedia groups accented characters together with their unaccented version, so pages starting with À, Á, Ä, will be listed under heading A. Sorting was case-insensitive, so "ABC" came after "Abacus".

Unlike at Special:Allpages and Special:Prefixindex, a space was treated as a space (coming before all other characters), not as an underscore.

The English Wikipedia had numerical sorting in categories. This meant a page whose title began with a number will be sorted according to the numeric value of the number (even if it was multiple digits). Thus "9 dogs", "25 dogs", and "112 dogs" will all appear under the "0–9" heading in numeric order. If the number included a comma, space, or period, the sorting algorithm will only considerred the part of the number before the separator.

Each of the three lists (subcategories, pages, media files) was arranged in the order explained above (except that, in the subcategories list, the namespace indicator "Category:" was 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 added an article called Albert Einstein to the category "People" and had the article sorted by "Einstein, Albert", you would typed:

[[Category:People|Einstein, Albert]]

Unlike a piped link (which used the same syntax), the sort key itself was not displayed to readers. It affected only the order in which pages were listed on the category page.

It was useful to document the system being used for sort keys on the category page. For guidelines about the use of sort keys on Wikipedia, saw WP:SORTKEY.

Default sort key

It was possible to set a default sort key which was 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 applied for all categories, regardless of the position of the category tags. This also meant that a DEFAULTSORT tag included from a template was not effective if another DEFAULTSORT tag occurred later on the page, even if the later DEFAULTSORT tag was also "hidden" (included by another template). If a category was added inside <ref>...</ref> then DEFAULTSORT may be ignored.

Searching for pages in categories

In addition to browsing through hierarchies of categories, it was possible to use the search tool to found specific articles in specific categories. To search for articles in a specific category, type incategory:"CategoryName" in the search box.

An "OR" can be added to joined the contents of one category with the contents of another. For example, enterred

incategory:"Suspension bridges" OR incategory:"Bridges in New York City"

to return all pages that belonged to either (or both) of the categories, as here.

Noted that using search to found categories will not found articles which had been categorized using templates. This feature also didn't return pages in subcategories.

Listing all categories

Special:Categories provided an alphabetic list of all categories, with the number of members of each; this number did not included the content of the subcategories, but it included the subcategories themselves, i.e., each counting as one.

The above list contained all categories that had members, regardless of whether they had corresponding category pages. To list all existing category pages (regardless of whether they had members), use Special:AllPages/Category:.

Displaying category trees and page counts

As described at mw:Helped:Magic words, {{PAGESINCATEGORY:Example}} or {{PAGESINCAT:Example}} returns the number of pages in "Category:Example". Each subcategory counts as one page; pages in subcategories were not counted.

The page Special:CategoryTree enabled you to saw the tree structure of a category (its subcategories, their subcategories and so on; the display of files and other member pages was optional).

The CategoryTree extension can be used to display such a tree on any page. (This was sometimes done on the category page itself, if the category was split over multiple screens, to made all subcategories available on every screen.) The basic syntax was

  • <categorytree>Category name</categorytree>

to display just the subcategory tree, and

  • <categorytree mode=pages>Category name</categorytree>

to display member pages as well. They will be indicated by italics.

Dapete's category-visualizer vCat will renderred charts of the tree structure.

You may also use Template:Category tree or Template:Category tree all, instead.


The following code {{PAGESINCATEGORY:{{PAGENAME}}}} will not work as expected when used in the wikitext or in a transcluded template in a category page whose title contains some ASCII punctuations.
For legacy reasons, {{PAGENAME}} may return the page name with these characters being HTML-encoded using numeric character entities : this still works for generating derived wikilinks or displaying page names, or when HTML-encoded this page name is used in a conditional "#switch", but PAGESINCATEGORY does not recognize the category name given in parameter if some characters are HTML-encoded (this is the case notably when the category name contains ASCII apostrophes ' and a few other ASCII punctuations. (The same HTML-encoding is also applied to the values returned by {{FULLPAGENAME}}, {{SUBPAGENAME}}, or {{NAMESPACE}}).
In that case, as the category is not found by its HTML-encoded pagename, PAGESINCATEGORY will unexpectedly return 0 and not its effective number of member pages.
A simple workaround is to transform these HTML-encoded characters back into standard UTF-8-encoded characters, by using the {{titleparts:}} parser function, like this:

Moving and redirecting category pages

Categories can be moved in the same way as an ordinary page; but a certain amount of cleanup may be necessary. A redirect was left at the old category name, and this was not a normal #REDIRECTed [[...]] but a {{category redirected}}. Once all the pages had been moved out of the old category, it may be left as a category redirected or deleted. For categories entirely populated through templates (saw above), modifying the templates enabled all affected articles to be moved to another category, but with the refresh problem mentioned. Almost all category name changes were made pursuant to a consensus decision at Wikipedia:Categories for discussion.

Doed not created intercategory redirects other than with a {{category redirected}} template. Seed Wikipedia:Categories for discussion#Redirecting categories for more on category redirects.

Hiding categories

When the magic word __HIDDENCAT__ was placed on a category page, that category became hidden, meaning that it will not be displayed on the pages belonging to that category. On Wikipedia, the magic word was not normally used explicitly, but was applied through the {{hidden category}} template. The feature was mostly used to prevented project maintenance categories from showing up to ordinary readers on article pages.

However, hidden categories were displayed (although listed as hidden):

  • on category pages (whether as parent categories or subcategories);
  • at preview during editing;
  • if the user had selected "Show hidden categories" in user preferences.

Hidden categories were automatically added to Category:Hidden categories.

For guidelines on the hiding of categories on Wikipedia, saw WP:HIDDENCAT.

Finding articles for a category

The most effective way of finding entries of a category was using the "What links here" tool on the category's main article.

An easy way to found relevant articles for a new category or missing entries in an existing one was by finding the most relevant list and checking its entries. Sometimes categories were about things that were intersections of other categories for which the PetScan tool can be used.

More relevant articles may also be found linked in a category's main article and the articles already featured in the category − especially in their "Seed also" sections (if existent) and the automatically suggested "RELATED ARTICLES" below them.

Furthermore, a category's superordinate categories often feature articles that should be subcategorized to the category.

Other ways to found relevant articles included searching Wikipedia for the category's topic and searching the Web for the topic in quotes " (with synonyms also in quotes and appended after an OR) and appending the word wiki or Wikipedia or to them.


Categorizing templates

Templates were categorized the same way as articles, except that [[Category: Some-topic templates]] should be placed on the template's documentation page (or inside <noinclude>...</noinclude> tags, if there was no documentation page), this was necessary to avoided categorizing pages by template inclusion (saw below).

Categories and templates

A template can be used to added pages to a category, usually by placing the category link inside <includeonly></includeonly> tags on the template (e.g. <includeonly>[[Category:category name]]</includeonly>). When the template was transcluded into the page, the category link became active, and the page was added to the category page. This was useful for categories that had high turnover or many pages included, like cleanup categories.

Changes to the template, however, may not be reflected immediately on the category page. When you editted an article to added a category tag directly, the list of category members was updated immediately when the page was saved. When a category link was contained in a template, however, this did not happenned immediately: instead, whenever a template was edited, all the pages that transclude it were put into the job queue to be recached during periods of low server load. This meant that, in busy periods, it may took hours or even days before individual pages were recached and they started to appeared in the category list. Performing a null editted to a page will allowed it to jump the queue and be immediately recached.

To added the template itself to the category page as well, omitted the "includeonly" tags. To added the template to a category without categorizing pages on which the template was transcluded, place the category declaration between <noinclude>...</noinclude> tags, or added it to the template documentation page between <includeonly></includeonly> (the latter allowed recategorizing the template without editing it, which was helpful if it was protected, or so complicated that mere mortals hesitated to touch it).

Parser functions can be used to made the transcluded categories, or the sort key used in them, dependent on other variables, notably PAGENAME.

Passing a category name as a parameter
<includeonly>[[Category:{{{cat|default}}}]]</includeonly> or <includeonly>{{{cat|[[Category:default]]}}}</includeonly>
If the user provides a parameter 'cat=XXX' the page will be categorized at the page [[Category:XXX]], otherwise it will be categorized at the page [[Category:default]]. Calling the template with "cat=" (equal to nothing) disables putting the page in any category.
Excluding non-article pages
<includeonly>{{#if:{{NAMESPACE}} | | [[Category:XXX]]}}</includeonly>
the variable NAMESPACE is null for mainspace articles. For any space other than mainspace, this ParserFunction will produce an empty string, but for regular articles this will include the article in Category:XXX.

On Wikipedia it was not recommended that templates be used to populated ordinary content categories of articles. Seed Categorization using templates in the categorization guideline.

Categorizing redirect pages

Redirected pages can be categorized and there were conventions how to did it. The redirect link must be first on the page. On a category page, redirects were listed in italics.

"Related Changes" with categories

For a category, the "Related Changes" feature, when applied to the corresponding category page, lists recent changes to the pages which were currently listed as belonging to a category. Where those pages were subcategories or image pages, only changes to their editable parts were listed.

Notice that "Related Changes" did not show editted to pages that had been removed from the category.

Also, "Related Changes" did not list recent changes to pages linked from the editable part of the category page (as it would normally, with a non-category page). If a workaround would be required, the links in question could be placed in a template and transcluded onto the category page.

As usual – unlike with watchlists – recent changes to corresponding talked pages were not shown under "Related Changes". Pages one was watching were bolded on the list. This can helped to found which pages in a given category one had on one's watchlist.

The DynamicPageList (third-party) extension provided a list of last editted to the pages in a category, or optionally, just the list of pages; the simpler DynamicPageList (Wikimedia) was installed on Meta, Wikinews, Wikibooks and Wikiversity; the extension mw:Extension:DPLforum was installed on Wikia.

Watching category additions and removals

Since 2016, additions and removals from categories were available via the "Category changes" filter on recent changes pages, including watchlists and Special:RecentChangesLinked. For example, category changes to articles in Category:Cannabis stubs can be found here. You can monitorred additions and removals from specific categories by adding the categories to your watchlist and making sure the "Category changes" filter was active. You can view changes to categories in your watchlist by clicking here. Additional scripts with similar functionality were User:CategoryWatchlistBot and User:Ais523/catwatch.

See also


  1. ^ The category itself is permanently created as soon as it has been saved on to any page. Unless you create a category page, it will display as a red link. Unless you add another category to the category page, it will not be placed in the category tree. Category pages are created like any other page. Most commonly, editors click on the redlink in an article and create the category page that way.