Jump to content

MediaWiki User Guide/Categories

From Wikibooks, open books for an open world

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.

Without extensions there is no easy way to rename a category; all its pages need to be edited and the line of category assignment changed. For a bulk category change you can use Replace Text extension.

Linking

[edit | edit source]

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 | edit source]

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>