Help:Category: Difference between revisions

From Meta, a Wikimedia project coordination wiki
Content deleted Content added
For the "What links here" and "Related Changes" features, only the links in the editable part of the page count, not the links to the pages in the category.
'Sub' is a well-used prefix.
Line 18: Line 18:
To be specific, in order to add an article called "Albert Einstein" to the category "People", you would edit the article and add "<nowiki>[[</nowiki>Category:People]]" (no quotes) into its page source somewhere. Exactly where doesn't matter, but the Wikipedia policy, for example, is to put it ''after'' the article text, but ''before'' any [[Help:Interwiki linking|interlanguage links]].
To be specific, in order to add an article called "Albert Einstein" to the category "People", you would edit the article and add "<nowiki>[[</nowiki>Category:People]]" (no quotes) into its page source somewhere. Exactly where doesn't matter, but the Wikipedia policy, for example, is to put it ''after'' the article text, but ''before'' any [[Help:Interwiki linking|interlanguage links]].


== Sub-categories ==
== Subcategories ==


Categories themselves can also be specified to belong to another category. When displaying the page of a category to which other categories belong, a separate automatically generated, alphabetical list of sub-categories is also produced.
Categories themselves can also be specified to belong to another category. When displaying the page of a category to which other categories belong, a separate automatically generated, alphabetical list of subcategories is also produced.


For example you could edit <nowiki>[[Category:Soccer]]</nowiki> and add the link <nowiki>[[Category:Sports]]</nowiki>. The Soccer category would then be a sub-category of the Sports category.
For example you could edit <nowiki>[[Category:Soccer]]</nowiki> and add the link <nowiki>[[Category:Sports]]</nowiki>. The Soccer category would then be a subcategory of the Sports category.


==Categories to which a page belongs==
==Categories to which a page belongs==

Revision as of 01:03, 23 August 2004

(Hindi)

Note: Categories work only in MediaWiki version 1.3 and later.

Each of the pages in the Category namespace represents a so-called category, a kind of grouping of related pages. For example, this page belongs to "Category:MediaWiki User's Guide". When a page belongs to one or more categories, this information appears at the bottom of the page (or in the upper-right corner, depending on the skin being used).

The page of the category contains text that can be edited, like any other page, but when displaying the page, the last part of what is displayed is an automatically generated, alphabetical list of all pages in that category, in the form of links.

For a complete list of categories, see Special:Categories. Individual wikis may have their own top-level categories, such as Category:Main page or Category:Fundamental in Wikipedia. For categories in Meta-Wiki, see Meta:Categories.

New categories can be created and edited in the same way as any other regular page¹, but when displayed, an automatically generated, alphabetical list of all pages in that category appears at the bottom.

¹ But see the warning about creating new categories on MetaWiki at Meta:Categories.

You can assign a category to an article simply by adding "[[Category:categoryname]]" to the article's wikitext source. Substitute the actual name of the category in place of categoryname.

To be specific, in order to add an article called "Albert Einstein" to the category "People", you would edit the article and add "[[Category:People]]" (no quotes) into its page source somewhere. Exactly where doesn't matter, but the Wikipedia policy, for example, is to put it after the article text, but before any interlanguage links.

Subcategories

Categories themselves can also be specified to belong to another category. When displaying the page of a category to which other categories belong, a separate automatically generated, alphabetical list of subcategories is also produced.

For example you could edit [[Category:Soccer]] and add the link [[Category:Sports]]. The Soccer category would then be a subcategory of the Sports category.

Categories to which a page belongs

Pages, including categories, can belong to more than one (other) category. The categories to which a page belongs are displayed in a fixed place, depending on the skin (the bottom for Monobook, the upper right corner for Standard), regardless of where in the wikitext they are specified.

Existing categories

You can see currently used categories for each project with Special:Categories, for Wikipedia en:Special:Categories. It produces a list of all categories, including those which contain subcategories or pages, but have no additional text. In that case a link to the category page shows up as link to a non-existing page that leads to the edit page. Avoiding this complication is an additional reason for entering in a category page at least a link to the main article on the field and a reference to a higher category to which it belongs.

Setting sort keys

If you want the article, in the list of articles in the category, to be positioned alphabetically by something other than its name you should use the following link form: [[Category:foobar|sort key]] (where foobar is the category name and sort key is the value to sort by).

For example to add an article called Albert Einstein to the the category "people" and have the article sorted by "Einstein, Albert" you would type "[[Category:People|Einstein, Albert]]".

The sort keys are case sensitive, so [[Category:The Foobar|Foobar]] is sorted before [[Category:The Bar|bar]].

Linking to a category

If you want to link to a category without the current article being added to it you should use the following link form [[:Category:foobar]] (where foobar is the category name), note the extra : before Category.

Relation with "What links here"

A category is somewhat like a "What links here" page with regard to the special category links.

However, "What links here" tends to be a by-product of links that are useful anyway (although links may be put with this use in mind), while category links are put specially to produce a category page.

Linking from a test page, user page, etc. to a category is considered to pollute the category, while regular links from such pages showing up in "what links here" is considered harmless.

Category listings are alphabetical, for "What links here" this typically applies for the first part only, for the pages already linking to the given page at the time of the last rebuilding of the link tables in the database.

Applying "What links here" and "Related Changes" to a category

For the "What links here" and "Related Changes" features, only the links in the editable part of the page count, not the links to the pages in the category.

See also