Help:Category - Wikinews, the free news source Jump to content

Help:Category

From Wikinews, the free news source you can write!
This is a copy of m:Help:Category using Wikinews-specific templates. Don't edit this page, except to replace the contents with the current version of that master page. To make changes applicable on all projects, edit the master page; to change Wikinews-specific content, edit the templates; to make demos work, copy templates to this project, and images to Wikimedia Commons. Please see the history of the master page for author details. Please note that all meta content is licensed under the GFDL. As a result this page is licensed under the GFDL. - Edit this template

Categories provide automatic indexes, that are useful as table of contents. Together with links and templates they structure a project.

For a complete/alphabetical list of categories, see Special:Categories.
Categories at meta:Main page is like this page but bigger and more general.
Category:top_level is hierarchical

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

How to add a category, and include a page in a category

[edit]

Just link to the category name, in the namespace "Category"
ex:

[[Category:Category Name]]

and it is done.

Linking to a category

[edit]

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

Subcategories

[edit]

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

[edit]

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

[edit]

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

[edit]

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: ''foobar''nowiki (ctrl-click)">[[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 category "people" and have the article sorted by "Einstein, Albert" ("Einstein" is the 1st sort key and "Albert" the 2nd) you would type "[[Category:People|Einstein, Albert]]".

The sort keys are case sensitive, so ''The_Foobar''nowiki (ctrl-click)">[[Category:The Foobar|Foobar]] is sorted before ''The_Foobar''nowiki (ctrl-click)">[[Category:The Foobar|bar]].

A category tag in a template; caching problem

[edit]

If a template contains the code indicating that it is in a category, this does not only put that template in the category, but also the pages that include the template. For example, this page includes Template:Hh and as a result is in Category:English documentation.

The page that contains the template correctly lists the categories to which it belongs. However, adding or deleting a category tag in the template does not add or delete the listings on the category page of pages that use the template, until some edit is made in the page that uses the template.

In other words:

  • lists of categories a page is in, are up-to-date
  • lists of pages in a category are based on the situation just after the last edit of the pages

Since adding or removing a category or template tag is obviously an edit there is only a complication when a page is indirectly added to or deleted from a category, through a change in a template the page uses.

In order to update a page in such cases, use "action=purge", in a URL like //en.wikinews.org/w/index.php?title=Help:Category&action=purge

[edit]

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.

[edit]

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.

Conventions and project-specific settings

[edit]

Each page is typically in at least one category. It may be in more, but it may be wise not to put a page in a category and also in a more general category.

Each category, except one top-level category, is typically in at least one higher level category.

Check the conventions in a project and make yourself familiar with the categories in use before assigning pages and subcategories to categories and before creating new categories.

For category names the usual rules for case-sensitivity of page names apply: they are case-sensitive beyond the first character, but in most projects the first character is case-insensitive. So be aware that you create a new category if the capitalization beyond the first character is not the same.

How categories are implemented

[edit]

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:English documentation". 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 (in fact ASCII order, see Help:Special pages).

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.

You can assign a category to an article simply by adding "''categoryname'' (ctrl-click)">[[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.

Category page note

[edit]

You can include the template template:category note {{category note}} into the category page's description, which can link to your top level category and include basic help.

here it is for this site

[edit]
This page is a category.

Category listings:

To add an existing page to a category:

  1. go to that page and click the edit tab
  2. create a Wiki link in that page with the

ex:

[[Category:Category name]]

3. your page is now listed in that category page!


See also

[edit]
[edit]
Help contents

Reading: Go | Search | URL | Namespace | Page name | Section | Link | Backlinks | Piped link | Interwiki link | Redirect | Variable | Category
Tracking changes: Recent | (enhanced) | Related | Watching pages | Page history | Diff | User contributions | Edit summary | Minor edit
Logging in and preferences: Logging in | Preferences | User style
Editing: Overview | New page | Images/files | Image description page | Special characters | Formula | Table | EasyTimeline | Template | Renaming (moving) a page | Automatic conversion of wikitext | Talk page | Testing || rlc | Meta | Wikibooks | Wikicommons | Wikipedia | Wikiquote | Wikisource | Wiktionary