Template:C

From Wikimedia Commons, the free media repository
(Redirected from Template:Wikipedia category)
Jump to: navigation, search

[[Category:{{{1}}}]]

Documentation icon Documentation[view] [edit] [history] [purge]

This documentation is transcluded from Template:C/doc.

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

Usage

{{C |1= |2= |3= }}

Template parameters

Parameter Description Default Status
1 category name empty required
2 link text to display (instead of category name) empty optional
3 The 3rd parameter establishes either
  • interwiki access, with any language code,
or
  • a link to a category of the 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
if 3=x (lower case): text is displayed in red color
if 3=X (upper case): display with red background
empty optional

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

Usage

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

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

Adressing categories within the commons

First of all, always a check for existence is performed.

When the category exists, code is implemented as:

[[:Category:{{{1}}}|{{{2|{{{1}}}}}}]]

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

[[:Category:{{{1}}}|{{{2|{{{1}}}}}}]]

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


example


  • {{C|Category-not-existing}} produces [[Category:Category-not-existing]]
  • {{C|Category-not-existing|Red_Link}} produces [[Category:Red_Link]]


  • {{C|Not-existing-cat}} produces [[Category:Not-existing-cat]]
  • {{C|Not-existing-cat|display}} produces [[Category:display]]
  • {{C|Not-existing-cat|3=x}} produces [[Category:Not-existing-cat]]
  • {{C|Not-existing-cat|display-cat|x}} produces [[Category:display-cat]]
  • {{C|Not-existing-cat|3=X}} produces Not-existing-cat
  • {{C|Not-existing-cat|displayname|X}} produces displayname


Interwiki access

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