From 2021pedia

<languages /> Template:PD Help Page <translate> Categories, a software feature of MediaWiki, provide automatic indexes that are useful as tables of contents.

You can categorize pages and files by adding one or more Category tags to the content text. These tags create links at the bottom of the page that take you to the list of all pages in that category, which makes it easy to browse related articles.


Each of the pages in the Category [[<tvar name=ns>Special:MyLanguage/Help:Namespaces</tvar>|namespace]] represents a so-called category, a grouping of related pages, and contains an index for the pages of its category. For example, this page belongs to "<tvar name=cat>Lua error in package.lua at line 80: module 'Module:Lang/ISO 639 synonyms' not found.</tvar>". If you open the category page, you will see a link to this page there.

When a page belongs to one or more categories, these categories appear at the bottom of the page (or in the upper-right corner, depending on the [[<tvar name=1>Special:MyLanguage/Help:Preferences</tvar>|skin]] being used).

The category pages themselves contain 2 parts:

  • at their beginning, an optional part may contain text that can be edited, like any other page,
  • at their end, an ever present, automatically generated, alphabetical list of all pages in that category, in the form of links. In fact, in the Unicode sort order.

To assign a category to a page, simply add the link "[[Category:Category name]]" to the page's wikitext. The usual place to add it is at the bottom of the page.

To link a category page 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]]

A new category can be [[<tvar name=1>Special:MyLanguage/Help:Starting a new page</tvar>|created]] before assigning any page to it, in the same way as any other regular page.

Individual wikis may have their own top-level categories, such as Category:Contents in Wikipedia.

For a complete list of all categories which have at least one page, see <tvar name=1>Special:Categories</tvar>.

For a complete list of all created/edited categories, including the ones that don't have any pages, see <tvar name=1>Special:Allpages/Category:</tvar> (note the colon at the end).

Adding a page to a category[edit]

To add a page or uploaded file to a category, simply edit the page and add the following text (where Name is the name of the category you want to add it to). </translate>

[[Category:<translate> Name</translate>]]

<translate> Any number of <tvar name=2>Category</tvar> tags may be added to the page and the page will be listed in all of them. <tvar name=2>Category</tvar> tags, along with {{<tvar name=1>ll|Manual:Interwiki#Interwiki_links_to_other_languages</tvar>|interwiki language links}} placed in the sidebar, are usually added at the very bottom of the page for the convenience of other editors.

On a categorized page, categories are displayed in the Categories: box strictly in the order they appear in the wikitext. </translate>

<translate> If <tvar name=UseCategoryBrowser>Lua error in package.lua at line 80: module 'Module:Lang/ISO 639 synonyms' not found.</tvar> is set to true, under the first list each category is listed again, breadcrumb-style, with all its parent categories, sorted alphabetically.</translate> <translate> (At least in MediaWiki 1.18.2) if a category is a subcategory of more than one parent, both hierarchies will be listed, but the tagged category will be stripped off all but one of these.</translate> <translate> This creates the potential for what appear to be duplicate entries if a category with multiple parents and one of its parents are both tagged on a page.</translate> <translate> For example suppose Maryanne is a subcategory of both Mary and Anne.</translate> <translate> If a page tags categories Maryanne and Anne then the Category breadcrumbs will show</translate>

Mary -> Maryanne

<translate> "Anne" appears to be duplicated, but what is meant is </translate>

Anne -> Maryanne
Mary -> Maryanne

<translate> This is a bug, and has been reported in <tvar name=1>phab:T35614</tvar>.

Sort key[edit]

</translate> <translate> By default, a page is sorted within a category under the first letter of its name — without the namespace.</translate> <translate> Also, MediaWiki groups accented characters separately from their unaccented version, so pages starting by À, Á, Ä, will be listed under separate headings, instead of under heading A.</translate> <translate> (If you have shell access, these defaults can be changed using <tvar name=CategoryCollation>Template:Wg</tvar>.)</translate>

<translate> A sort key specifies under which letter heading, and where in the category list, the page will appear. You can add a sort key by placing it inside the tag after a pipe character. For example, the tag below will add the page under heading "S". </translate>

[[Category:<translate> Name</translate>|<translate> Sort</translate>]]

<translate> Whether or not sort keys are case-sensitive [[<tvar name=help>Special:MyLanguage/Help:Sorting#Categories</tvar>|depends on your configuration settings]].</translate> <translate> The order of the sections within a category follows the Unicode sort order. The sort key does not change the page title displayed in the category.</translate>

<translate> Spaces and other characters are perfectly valid.

See <tvar name=1>Lua error in package.lua at line 80: module 'Module:Lang/ISO 639 synonyms' not found.</tvar> for further information on category sorting.

Creating a category page[edit]

Categories exist even if their page has not been created, but these categories are isolated from others and serve little purpose for organization or navigation.

A category is created by creating a page in the Category: namespace. A category page can be created the same way as other wiki pages (see <tvar name=help>Lua error in package.lua at line 80: module 'Module:Lang/ISO 639 synonyms' not found.</tvar>); just add "<tvar name=code>Category:</tvar>" before the page title.

To avoid extra work, try searching within your wiki before creating a new category. The list of all categories can be found in "<tvar name=1>Template:Int</tvar>" in the "<tvar name=2>Template:Int</tvar>" box of the [[<tvar name=3>Special:MyLanguage/Help:Navigation#Sidebar</tvar>|sidebar]].

Managing the category hierarchy[edit]

Categories may belong to other categories in a hierarchy. Since category pages are much like any other page, a <tvar name=1>Category</tvar> tag may be added to the bottom of a category page.

It is a good idea to organize all categories into a hierarchy with a single top level category. The category structure can take the form of a tree with separate branches, but more often will have a graph structure. Generally, there should be a contiguous chain of parent-child links between each category and the top level category.

Category tree[edit]

</translate> Template:Main

<translate> Since MediaWiki 1.31, <tvar name=1>Lua error in package.lua at line 80: module 'Module:Lang/ISO 639 synonyms' not found.</tvar> extension is packaged by default, allowing <tvar name=2>Special:CategoryTree</tvar> and <tvar name=3><categorytree></tvar> to provide a tree-like structure display for the categories.

Hidden categories[edit]

The categories that a page is in are normally listed at the bottom of the page. In MediaWiki 1.13+, a category can be hidden from this list by adding the [[<tvar name=1>Special:MyLanguage/Help:Magic words</tvar>|magic word]] "<tvar name=2>__HIDDENCAT__</tvar>" to the category page.

Users can choose to see hidden categories in a separate "<tvar name=1>Template:Int</tvar>" list, by checking "<tvar name=2>Template:Int</tvar>" in the "<tvar name=3>Template:Int</tvar>" section of <tvar name=4>Special:Preferences</tvar>. </translate>

<translate> Hidden categories are automatically added to <tvar name=1>Category:Hidden categories</tvar>.</translate> <translate> This category is specified in the system message <tvar name=1>MediaWiki:Hidden-category-category</tvar>.</translate>


Linking to a category[edit]

To create a link to a category, use a leading colon before the category name (without this colon, the current page would be added to the category): </translate>


<translate> To change the link text, write the text inside the link tag after a pipe: </translate>

[[:Category:Help|<translate> Help category</translate>]]<translate> Help category</translate>

<translate> [[<tvar name=1>Special:MyLanguage/Help:Redirects</tvar>|Redirect pages]] that redirect to categories must also use the colon, otherwise they will be added to the category instead of redirecting.

Categories and templates (transcluded pages)[edit]

If you add <tvar name=1>[[Category:Cats]]</tvar> inside a template (a transcluded page), both the template and pages which transclude this template will be categorized as <tvar name=2>Cats</tvar>. </translate>

  • <translate> If you want only the template to be categorized, you should ensure to write category marker inside <tvar name=1>Lua error in package.lua at line 80: module 'Module:Lang/ISO 639 synonyms' not found.</tvar> tags.</translate>
  • <translate> If you want only the pages which uses the template to be categorized, but not the template itself, you should ensure to write category marker inside <tvar name=1>Lua error in package.lua at line 80: module 'Module:Lang/ISO 639 synonyms' not found.</tvar> tags.</translate>

<translate> Due to caching issues, editing categories applied through templates may take a while to be visible everywhere.</translate> <translate> You can perform a [[<tvar name=1>Special:MyLanguage/Manual:Null edit</tvar>|null edit]] on a page to update immediately its categories.</translate>


Redirecting a category[edit]

Like normal wiki pages, category pages can be redirected to other normal or category pages. However, this is not recommended, as pages categorized in redirected categories do not get categorized in the target category (<tvar name=1>phab:T5311</tvar>). Some Wikimedia sites use a "category redirect" template to mark redirected categories, allowing manual or automated cleanup of pages categorized there.

Tracking categories[edit]

</translate> <translate> Certain syntax issues, such as a broken image link, or too many expensive parser functions, can cause a page to be added to a tracking category.</translate> <translate> See <tvar name=1>Lua error in package.lua at line 80: module 'Module:Lang/ISO 639 synonyms' not found.</tvar> for details.</translate>


Renaming a category[edit]

If you move a category, since [[<tvar name=1>#Redirecting a category</tvar>|redirect will not work for categorizing]], all category tags will be wrong, so you have to fix them.

See also[edit]


  • Lua error in package.lua at line 80: module 'Module:Lang/ISO 639 synonyms' not found.

[[Category:Help{{#translation:}}|Categories]] [[Category:Category{{#translation:}}]]

This category currently contains no pages or media.