| 👁 Warning | This template is used on approximately 223,000 pages. To avoid major disruption and server load, any changes should be tested in the template's /sandbox or /testcases subpages, or in your own user subpage. The tested changes can be added to this page in a single edit. Consider discussing changes on the talk page before implementing them. |
| 👁 Image | This template uses Lua: |
Usage
This template is for use on Category pages, to link to the primary article associated with this category, which, most of the time, describes the entire set containing the category. In many cases, the category and its main article will have the same title.
This template is not a replacement for adding a category to the main article. The main article of a category should always be in the category, and it should use a space as the sort key so that it appears at the top of the category. Example: the article Internet should have the category [[Category:Internet| ]].
Normal usage:
{{}}results in
In most cases, this is all that will be required. The template will automatically link to the mainspace page with the same title as the category, or if the title of the category corresponds to a redirect in mainspace, the target of that redirect. For example Category:Wildfires corresponds to Wildfires, which redirects to Wildfire; if Category:Wildfires uses {{}} without any arguments, it will display and link Wildfire.
If the template results in a red link, consider creating a redirect to the correct article if appropriate, or else the hatnote should possibly not be used. For articles that provide related information but are not the main article for the category, use another hatnote, such as {{Category more}}.
Specifying the link
If the name of the main page is different than the name of the category — for example: if the main article for Category: Dead or Alive (series) is Dead or Alive (franchise) — you can use one parameter to specify the article:
{{|Dead or Alive (franchise)}}results in
In some cases, if the category name and its main article do not match, the category may need renaming per WP:C2D.
Multiple pages
For multiple links, simply append more pages as additional arguments (up to five):
{{|1 BC}}results in{{|1 BC|2 BC}}results in{{|1 BC|2 BC|3 BC|4 BC|5 BC}}results in
Pages which aren't articles
The template automatically detects page titles being outside the article namespace and replaces the word article with page in the hatnote. This may also be set manually:
{{|Wikipedia:WikiProject|article=no}}results in
TemplateData
TemplateData for Category main article
| Parameter | Description | Type | Status | |
|---|---|---|---|---|
| Article 1 | 1 | Name of primary article, if different from category name | Page name | optional |
| Article 2 | 2 | Name of second main article | Page name | optional |
| Article 3 | 3 | Name of third main article | Page name | optional |
| Article 4 | 4 | Name of fourth main article | Page name | optional |
| Article 5 | 5 | Name of fifth main article | Page name | optional |
Tracking categories
If the template is used in the Article or Draft namespaces, the page will be added to the hidden tracking category Category:Articles using category hatnotes.
If the hatnote links to a non-existent page (i.e. a red link), the category will be added to Category:Categories with hatnote templates targeting a non-existent page.
If the name of the category and the link to its main article do not match (e.g. Category:Foo (bar) and Foo), the category will be added to Category:Category main article does not match category title. This is useful for finding links that need correcting and categories that need renaming to match their articles. (However, in many cases, the category and article not matching is intentional and not a problem.)
See also
- {{Category main section}}
- {{Topic category}}
- {{Main category}} – the inverse of this template, to be placed as a hatnote in the article section
