This page is semi-protected.


From Wikibooks, open books for an open world
(Redirected from Help:Category)
Jump to navigation Jump to search
See Wikibooks:Categories for a description of the Wikibooks-specific usage of categories.

Categories are a software feature of MediaWiki which allows indexing of pages, files, templates and other categories (referred collectively from now on as simply pages). Together with links and templates, categories help structure a book.

Pages are said to be "members of a category" if a category link is included in the text. Pages can be members of zero, one or more categories. Pages that are not a member of any category are said to be uncategorized. Pages should be a member of at least one category, except for Category:Categories, so that all pages can be found through the category system. An automated list of all uncategorized pages is maintained at Special:UncategorizedPages, Special:UncategorizedFiles, Special:UncategorizedTemplates and Special:UncategorizedCategories.

Category pages

Categories have an editable part that typically contains at least a description of the category's purpose, and the category links to any related categories. If the editable part has not been created, links to the category will treat the category as a new page.

Categories which themselves are categorized are said to be a subcategory for another category. However, categories allow more flexibility than simply a parent-child relationship.

Category pages may have a:

  1. Description section. This section is the only editable part and can include anything that is normally allowed on any other page.
  2. Related categories section, which lists categories that were categorized using this category, if any.
  3. Books and Pages section, which list books and pages that were categorized using this category if any.
  4. Files section, which lists files that were categorized using this category.

Adding __NOGALLERY__ to a category causes categorized files to be shown only by their name in the Books and Pages section, rather than showing a preview for supported file formats.

Category pages list only 200 pages at a time.

Adding pages

Each page lists the categories that it is a member of. Categories are listed in the order they first occurred. To add a page to a category, simply put [[Category:NAME]] in any page you are editing where NAME is the name of the category you want to add it to. This provides a link to the appropriate category page, which is in the "Category" namespace. Any number of categories may be added to a page, and the page will be listed in all the categories. Categories can be added wherever you like in the text, but in general for the convenience of other editors, categories are added at the bottom of content pages and at the top of discussion pages. Files can be categorized by adding categories to their description page.

If you want to link to a category without the current page being added to it, you should use the link form [[:Category:NAME]] (where NAME is the category name). Note the extra ":" before Category.

Please familiarize yourself with Wikibooks:Categories, before you start categorizing pages.

Sorting pages

A "sort key" can be added that specifies where a page will appear within a category. This is done by using [[Category:NAME|SORT]]. For example [[Category:Help|Category]] would add a page to the Help category and sort it under the "C" heading after "Can" and before "Catalog". Sort keys are case-sensitive, and even a space is recognized as a sort key. A sort key only affects how pages are ordered. A sort key does not change what name is used to display category and page links.

Without a sort key, pages by default are sorted using their full page name, this includes any namespace they belong to. The default sort order can be overridden by adding {{DEFAULTSORTKEY:SORT}} to pages where SORT is the name to sort pages under.

Pitfalls and Gotchas

  • Category pages currently cannot be moved or renamed.
  • Pages added to a redirected category continue to show in the original category rather than the new category.
  • Pages can only be added to a category once; only the last category link is used along with its sort key, and the rest are ignored.
  • Category listings may be outdated at times when categories contained within templates are changed.
  • "What links here" only shows pages which include [[:Category:NAME]] links. Note the extra ":".
  • "Related changes" can't be reliably used to detect when pages are added or removed, as it only shows changes to pages that are currently members of the category.