Difference between revisions of "Template:Categorizer"
J McKalling (Talk | contribs) m |
J McKalling (Talk | contribs) m |
||
Line 11: | Line 11: | ||
#if: {{{category|}}} | #if: {{{category|}}} | ||
| {{superlink|article=:Category:{{{category}}}|label={{{catlabel|list all}}} }} | | {{superlink|article=:Category:{{{category}}}|label={{{catlabel|list all}}} }} | ||
− | {{{nocat}}}{{ | + | nc={{{nocat}}}; |
+ | {{ | ||
#ifeq: {{lc: {{{nocat|false}}} }} | false | [[Category:{{{category}}}]] }} | #ifeq: {{lc: {{{nocat|false}}} }} | false | [[Category:{{{category}}}]] }} | ||
| {{superlink|label=missing category}} {{#ifeq: {{lc:{{SUBJECTSPACE}}}} | template | [[Category:Categorizers missing a category]] }} | | {{superlink|label=missing category}} {{#ifeq: {{lc:{{SUBJECTSPACE}}}} | template | [[Category:Categorizers missing a category]] }} |
Revision as of 17:51, 13 November 2012
This template is used to add a tag to an infobox, labeling and automatically categorize the article under a category. A superlink is used to render a link to the target category.
- {{categorizer | category = category name | catlabel = displayed text on categorylink | article = an article about the category | label = displayed text on articlelink }}
Parameters
- category: The target category to add this article to.
- catlabel: The text to display on the categorylink (defaults to "list all").
- article: The article that represents the target category (defaults to the label not to become linked).
- label: The text to display on the link to the article (defaults to the article pagename).
- nocat: Whether or not to suppress categorization under category (defaults to false, which means auto categorization).
Syntax
{{categorizer |category = |catlabel = |article = |label = |nocat = }}
Examples
Common use of the categorizer includes both category and article parameters:
{{categorizer|category = Quetches|article = Quetch}}
(and the page would be categorized under Category:Quetches)
Both the displayed texts on the category and article links can be customized using the catlabel and label parameters respectively:
{{categorizer |category = Quetches |catlabel = list members |article = Quetch |label = Men }}
(and the page would be categorized under Category:Quetches)
If the article parameter is left out, the categorizer won't render a link on the label:
{{categorizer|category = Quetches|label = Men}}
- Men [list all]
(and the page would be categorized under Category:Quetches)
If both the article and label parameters are left out, the categorizer will render error text like this:
{{categorizer|category = Quetches}}
- missing article [list all]
(and the page would be categorized under Category:Quetches, and templates would be categorized under Category:Categorizers missing an article)
If the category parameter is left out, regardless of parameter catlabel, the categorizer will render like this:
{{categorizer |catlabel = list members |article = Quetch |label = Men }}
- Men [missing category]
(and the page would not be categorized automatically, and templates would be categorized under Category:Categorizers missing a category)
The nocat parameter may be used to suppress automatic categorization like this (any value will do):
{{categorizer|category = Quetches|article = Quetch|nocat = true}}
(and the page would not be categorized under Category:Quetches)