Help:Categories

From Gentoo Wiki
Jump to:navigation Jump to:search

Categories provide automatic indexes that are useful as tables of contents. Use categories to group pages associated with a particular subject of interest together, to help users find pages and navigate the wiki. Categorize pages by adding a Category tag to the content text.

When a page is placed in a category, the categorization will show as a link at the bottom of that page. That link will lead to the category page which will contain a list with all the pages in that category, any subcategories, and may contain some content at the top, that can be edited like any other page.

As an illustration of what a category looks like, this page belongs to "Category:Help" so the "Help" category shows at the bottom of the page, and opening the "Category:Help" category page, there will be a link to this page in the list.

The top-level category of this wiki is Category:Wiki Root.

For a complete list of all categories which have at least one page, see Special:Categories, to include the ones that don't have any page, see Special:Allpages/Category: (note the colon at the end).

Note
Please don't add draft pages to categories, as this will clutter the categories up - wait until a page is finished to categorize it. Pages in the user namespace usually shouldn't be categorized, unless there is a particular reason to put them forward on the wiki.

Adding a page to a category

Just add a category tag to a page, the category will now exist even if the corresponding category page has not been created.

To add a page or uploaded file to a category, simply edit the page and add the following text, replacing Name with the name of the category to add the page to:

[[Category:Name]]

Any number of "Category" tags may be added to a page, which will then be listed on each corresponding category page. Category tags should usually be added at the very bottom of the page text, though they will work if included elsewhere.

Note
It is usually best to use the most specific subcategory possible when categorizing a page. By being categorized in a subcategory, it is implied that the page also belongs to parent categories. For example, a page in the Category:Archive utilities is also implicitly in Category:Software, as a parent category.
Tip
To link to 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]]

Creating a category page

Add content to a category page to help with navigation and to explain what the category is for.

A category page is added by creating an article in the Category: namespace, in the same way as other wiki pages (see Help:Starting a new page). The easiest way to create a category page is to first add a page to that category, and then click the link to the nonexistent category page at the bottom of the newly categorized page.

New categories can also be created before assigning any page to them, just add a page to the Category: namespace by adding "Category:" to the page name, before the category title.

To avoid extra work, check that similar categories do not exist before creating a new one. The list of all categories can be found in "Special pages" in the "tools" box of the sidebar.

Unlike other wiki pages, it is not possible to rename (move) a category. Rather than rename, a new category may be created to replace the old one, however the revision history will be lost, which is undesirable if there are many revisions.

Sort key

By default, a page is sorted under the first letter of its full name including the namespace (in ASCII order, see Help:Special pages). 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.

A sort key specifies under which letter heading, and where in the category list, the page will appear. 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":

[[Category:Name|Sort]]

Sort keys are case-sensitive, and spaces and other characters are also valid. 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.

Managing the category hierarchy

Categories may themselves belong to other categories, in a hierarchy: simply add a Category tag 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.

Hidden categories

The categories that a given page is in are normally listed in a section at the bottom of each page. A category can be hidden from this section by adding the magic word "__HIDDENCAT__" to the category page. Hidden categories are not hidden from category pages (bug 15550).

Users can choose to see hidden categories in a separate "Hidden categories" list, by checking "Show hidden categories" in the "Appearance" section of Special:Preferences.

Hidden categories are automatically added to Category:Hidden categories. This category is specified in the system message MediaWiki:Hidden-category-category.

Linking to a category

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

[[:Category:Help]]Category:Help

To change the link text, write the text inside the link tag after a pipe:

[[:Category:Help|Help category]]Help category

Redirect pages that redirect to categories must also use the colon, otherwise they will be added to the category instead of redirecting.

Redirecting a category

Like normal wiki pages, category pages can be redirected to other normal or category pages.