Documentationview · edit · history · purge ]
This documentation is transcluded from Template:C/doc.

Links to a category, either within the Commons or to another Wikipedia

In its simplest form, {{c|categories}} does the same as [[:cat:categories]] or [[:category:categories]],
but offers additional options for the layout formatting, the linking and more.


{{C |1= |2= }}

Template parameters

1category name, with or without a namespaceemptyrequired
2link text to display (instead of category name)param. #1optional
3The 3rd parameter establishes either
  • interwiki access, with any language code,
  • a link to a category on Commons, always with check for existence
    • existing categories are linked and displayed
    • non-existing categories are not linked, but displayed
(not specified): text is displayed in black color
when 3=x (lower case): text is displayed in red color
when 3=X (upper case): display with red background
  • when 3=B (upper case): text is displayed within [[…]]-brackets
  • when 3=G: [[Category: will be generated; par.2 is sorting option
4+/- to precede the category name with the namespace Category:
+ ("plus" sign) to make Category: a part of the link,
- ("minus" sign) to precede Category: as a plain text.

The +/- parameter can as well be specified with parameter 2 or 3

(If both signs are specified, "+" has precedence).

Additional information

The template is intended to be used in the following namespaces: all namespaces

The template is intended to be used by the following user groups: all users

See also


This template is not intended to be localized.

The template does not generate any localizable text. With + or - always the namespace (in English) is used.


Standard usage

Displays a link to a category name. Parameter 1 is the category name. Parameter 2 may specify any text do be displayed instead.

The template will display {{{2}}}, or just the category name given as {{{1}}}.

The standard usage is without any prefix and without a namespace. No test occurs, redlinks can result.

The text string in parameter 2 is always displayed as-it-is, with namespace if any is specified.

Extended usage

The function is different for internal access within the commons, and for interwiki access.

Within the commons

The template can generate 5 different displays, one for an existing and four for a not-existing category.

When parameter 3 is either X or x, or when a namespace is encountered, a check for existence is performed.
This can avoid the generation of a redlink to a not-existing category. When later the category is defined, the display occurs like standard as above.

When the category exists either with or without namespace the following explanation depends the existing category.

When the category exists, code is implemented as:


When the category does not exist but has elements assigned, a "red link" will be generated:


Otherwise if the category {{{1}}} does not exist no link will be generated;

[[Category:{{{1}}}]] or [[Category:{{{2}}}]] is displayed
[[Category:{{{1}}}]] or [[Category:{{{2}}}]] is displayed when {{{3}}} = x
{{{1}}} or {{{2}}} will get background color when {{{3}}} = X

  • {{ C }} produces [[:Category:{{{1}}}|{{{1}}}]]
  • {{ Cerror }} produces [[:Category:|error]]

  1. {{ CNot-existing-cat }} produces Not-existing-cat
    {{ CNot-existing-catdisplay }} produces display
  2. {{ CCategory:Not-existing-cat }} produces Category:Not-existing-cat
    {{ CCategory:Not-existing-catdisplay }} produces display
  3. {{ CNot-existing-cat3 = x }} produces [[Category:Not-existing-cat]]
    {{ CNot-existing-catdisplay-catx }} produces [[Category:display-cat]]
  4. {{ CNot-existing-cat3 = X }} produces Not-existing-cat
    {{ CNot-existing-catdisplaynameX }} produces displayname
Not-existing category containing elements (difficult to find an example, try one of Special:WantedCategories)
{{ CRedesX }} produces Redes
{{ CredesRed_Linkx }} produces Red_Link

Single and double namespace prefix:

Interwiki access

It is not possible to check for existence in other Wikipedias.
The link is always established, whether the category exists or not.

  • {{ CMainen }} or {{ CMain3 = en }} produces Main
  • {{ CWikipedia:HilfeGerman help pagesde }} produces German help pages
  • {{ CAccueilCatégorie:Accueilfr }} produces Catégorie:Accueil
  • {{ CKangxi radicalswiktionary }} produces Kangxi radicals
  • {{ CWikcionario:ApéndicesCategoría:Apéndiceswiktionary:es }} produces Categoría:Apéndices

Namespace display