MediaWiki User Guide/Categories

From Wikibooks, open books for an open world
< MediaWiki User Guide
Jump to: navigation, search

Pages in wiki can be put into categories, by placing a category assignment anywhere in them. An example:

 [[Category:Birds]]

Categories have their own namespace "Category:", and are pages of sorts too. A category can be put into another category, so the categories can form a hierarchy or other structures.

A list of uncategorized pages can be shown by Mediawiki software.

There is no easy way to rename a category; all its pages need to be edited and the line of category assignment changed.

Linking[edit]

A wikilink to a category needs to start with ":", such as

See also [[:Category:Birds]]

Otherwise, the page is put into the category instead of linking to it, and the wikilink is not shown.

Templates[edit]

Categories can be used in templates, just like in mainspace pages. However, when you put a category assignment into a template, all the pages using that template become a member of that category. That is sometimes the required effect, but it may be unwanted, for instance when you want to categorize the templates rather than the pages that use the templates. For that case, embrace the category assignment into <noinclude> tag, such as:

<noinclude>
[[Category:Maintenance templates]]
</noinclude>