Template:Category link/doc
{{Documentation subpage}}
{{High-use}}
{{Hatnote|{{tl|Category}} redirects here. You may be looking for {{tl|Wikipedia category}} or {{tl|Collapsible list}}.}}
{{Template shortcut|cl|CL|categ|category|Cat}}
: {{Tlx|Cl|category name}}
: {{Tlx|Cl|Category:category name}}
: {{Tlx|Cl|category name|link text}}
: {{Tlx|Cl|category name|link text|count{{=}}yes}}
: {{Tlx|Cl|category name|link text|count{{=}}yes|count_type{{=}}type}}
: {{Tlx|Cl|category name|link text|count{{=}}yes|count_type{{=}}type|backlog{{=}}backlog threshold}}
{{Tl|category link}} or its alias {{Tl|cl}} produces a link to a category in a similar fashion to {{Tl|Tl}} for a template. For example:
: {{Tlf|Cl|Africa}} produces: {{Cl|Africa}}
To specify the text used for the link, add it as a second parameter:
: {{Tlf|Cl|Africa|this category}} produces: {{Cl|Africa|this category}}
To add a count of everything in the category, add the {{Para|count|yes}} parameter:
: {{Tlf|Cl|Africa|count{{=}}yes}} produces: {{Cl|Africa|count=yes}}
If you just want to get a count of pages, files, or subcats, use the MW:Help:Magic words#PAGESINCAT:
: {{Tlf|Cl|Africa|count{{=}}yes|count_type{{=}}all}} produces: {{Cl|Africa|count=yes|count_type=all}} (default)
: {{Tlf|Cl|Africa|count{{=}}yes|count_type{{=}}pages}} produces: {{Cl|Africa|count=yes|count_type=pages}}
: {{Tlf|Cl|Africa|count{{=}}yes|count_type{{=}}subcats}} produces: {{Cl|Africa|count=yes|count_type=subcats}}
: {{Tlf|Cl|Africa|count{{=}}yes|count_type{{=}}files}} produces: {{Cl|Africa|count=yes|count_type=files}}
If you want to make counts standout for categories that have a backlog, use {{Para|backlog}}:
: {{Tlf|Cl|Africa|count{{=}}yes|backlog{{=}}20}} produces: {{Cl|Africa|count=yes|backlog=20}}
See also
- {{Tl|C}}, which produces output such as: {{C|Africa}} and {{C|Africa|Afrika}}
- {{Tl|Clc}}, which produces output such as: {{Clc|Africa}} and {{Clc|Africa|pages}}
- {{Tl|lc}}, which produces output such as: {{Lc|Africa}}
- {{Tl|lcs}}, which produces output such as {{Lcs|Africa}}
- {{Tl|tl}}, which links produces a link to a template surrounded by template-style double-braces (e.g. {{Tl|Africa}}).
- {{Cl|Internal category-link templates}}
- {{Cl|Internal link templates}}
- {{tl|Category see also}}
{{Internal category-link templates}}
|
Category:Internal category-link templates
}}
{
"description": "This template creates a link to a category and optionally displays the page count. If the page count exceeds a backlog threshold, it will be highlighted.",
"params": {
"1": {
"label": "Category name",
"description": "The name of the category to link to.",
"type": "string",
"required": true,
"example": "ExampleCategory"
},
"2": {
"label": "Display text",
"description": "The text to display for the link. If not provided, the category name is used.",
"type": "string",
"required": false,
"example": "Custom Display Text"
},
"count": {
"label": "Show count",
"description": "Specifies whether to display the number of pages in the category.",
"type": "boolean",
"required": false,
"example": "true",
"default": "false"
},
"backlog": {
"label": "Backlog threshold",
"description": "The threshold for the page count. If the count exceeds this value, it will be highlighted.",
"type": "number",
"required": false,
"example": "10"
},
"count_type": {
"label": "Count type",
"description": "Specifies the type of count to display (e.g., pages, files, or subcategories).",
"type": "string",
"required": false,
"example": "pages",
"default": "all",
"suggestedvalues": [
"all",
"pages",
"subcats",
"files"
]
}
},
"format": "inline"
}