Difference between revisions of "Template:Categorylink"
J McKalling (Talk | contribs) m |
J McKalling (Talk | contribs) (added infobox) |
||
(5 intermediate revisions by the same user not shown) | |||
Line 6: | Line 6: | ||
#if: {{{label|}}} | #if: {{{label|}}} | ||
| [[{{{article}}}|{{{label}}}]] | | [[{{{article}}}|{{{label}}}]] | ||
− | | [[{{{article}}}]] }}{{superlink|article=:Category:{{{category}}}|label={{{catlabel|list all | + | | [[{{{article}}}]] }}{{superlink|article=:Category:{{{category}}}|label={{#if:{{{catlabel|}}}|{{{catlabel}}}|list all}}}} |
|{{ | |{{ | ||
#if: {{{label|}}} | #if: {{{label|}}} | ||
− | |{{{label}}}{{superlink|article=:Category:{{{category}}}|label={{{catlabel|list all | + | |{{{label}}}{{superlink|article=:Category:{{{category}}}|label={{#if:{{{catlabel|}}}|{{{catlabel}}}|list all}}}} |
− | |[[:Category:{{{category}}}|{{{catlabel|}}}]] }} }} | + | |[[:Category:{{{category}}}|{{#if:{{{catlabel|}}}|{{{catlabel}}}|{{{category}}}}}]] }} }} |
− | }}</includeonly><noinclude> | + | }}</includeonly><noinclude>{{Infobox Template |
+ | |purpose=formatting | ||
+ | |singletag=no | ||
+ | |multiline=no | ||
+ | |gamerelated=no | ||
+ | |suppressible= | ||
+ | |choice= | ||
+ | |cat1= | ||
+ | |var1= | ||
+ | }} | ||
+ | |||
This template will render a link to a category. If the category has a main article and it is specified, a link to the article will be rendered instead and the link to the category itself will turn into a <nowiki>{{</nowiki>[[Template:Superlink|Superlink]]<nowiki>}}</nowiki>. | This template will render a link to a category. If the category has a main article and it is specified, a link to the article will be rendered instead and the link to the category itself will turn into a <nowiki>{{</nowiki>[[Template:Superlink|Superlink]]<nowiki>}}</nowiki>. | ||
Line 17: | Line 27: | ||
==Parameters== | ==Parameters== | ||
− | * '''category''': The name of the category to link to (case sensitive, defaults to nothing displayed) | + | * '''category''': The name of the category to link to (case sensitive, defaults to nothing displayed, not even a '''label''') |
* '''catlabel''': An optional text to display on the link to the category (case sensitive, defaults to '''category''' or to "list all" if it is a superlink) | * '''catlabel''': An optional text to display on the link to the category (case sensitive, defaults to '''category''' or to "list all" if it is a superlink) | ||
* '''article''': A main article for the category (case sensitive, pushes the link to the category into a superlink) | * '''article''': A main article for the category (case sensitive, pushes the link to the category into a superlink) | ||
− | * '''label''': An optional text to display on the link to the main article (case | + | * '''label''': An optional text to display on the link to the main article (case sensitive, defaults to '''article''') |
Line 32: | Line 42: | ||
<nowiki>{{categorylink | <nowiki>{{categorylink | ||
|category= | |category= | ||
− | | | + | |catlabel= |
|article= | |article= | ||
|label= | |label= | ||
Line 78: | Line 88: | ||
* the '''catlabel''' parameter is used to display an optional text on the '''category''' link | * the '''catlabel''' parameter is used to display an optional text on the '''category''' link | ||
* the '''label''' parameter is used to display an optional text on the '''article''' link if it is specified, or instead if not | * the '''label''' parameter is used to display an optional text on the '''article''' link if it is specified, or instead if not | ||
− | * if | + | * if either '''article''' or '''label''' is specified, the category link is pushed into a superlink behind it. |
− | |||
</noinclude> | </noinclude> |
Latest revision as of 09:36, 4 June 2014
Categorylink | |
---|---|
Purpose |
Formatting [list all] |
Single tag |
No [list all] |
Multi-line |
No [list all] |
Protected |
No [list all] |
Game related |
No [list all] |
Categorization | |
Categories |
none [list all] |
Variables | |
Names |
none [list all] |
Subpages |
This template will render a link to a category. If the category has a main article and it is specified, a link to the article will be rendered instead and the link to the category itself will turn into a {{Superlink}}.
This template does not actually categorize an article under the specified category, for that, use the {{Categorizer}} wrapper.
Parameters
- category: The name of the category to link to (case sensitive, defaults to nothing displayed, not even a label)
- catlabel: An optional text to display on the link to the category (case sensitive, defaults to category or to "list all" if it is a superlink)
- article: A main article for the category (case sensitive, pushes the link to the category into a superlink)
- label: An optional text to display on the link to the main article (case sensitive, defaults to article)
Note: The link to the category will be pushed into a superlink if either article or label or both are specified.
Note: The label may be used to optionally display custom text on the article link, but may also be used instead to remove the link and render text only.
Note: The catlabel may be used to optionally display custom text on the category link, but the latter is not optional, unlike article.
Syntax
{{categorylink |category= |catlabel= |article= |label= }}
Examples
Common use includes both the category and article parameters:
{{categorylink|category=Quetches|article=Quetch}}
Both the text of the category link and article link may be customized, like this:
{{categorylink |category=Quetches |catlabel=click here |article=Quetch |label=Resident }}
A different use includes only the category parameter, which would only render a link to the category itself like this:
{{categorylink|category=Grobos}}
And again the text of the category link may be customized, like this:
{{categorylink|category=Grobos|catlabel=Elephants}}
And even a third use includes the category parameter, combined not with the article but label parameter, which renders as the first example above but without a link on the article:
{{categorylink|category=Quetches|label=Quetch}} {{categorylink|category=Quetches|label=Quetch|catlabel=members}}
To summarize:
- the catlabel parameter is used to display an optional text on the category link
- the label parameter is used to display an optional text on the article link if it is specified, or instead if not
- if either article or label is specified, the category link is pushed into a superlink behind it.