Template:C/doc: Difference between revisions
More actions
m exp |
m +link |
||
| Line 50: | Line 50: | ||
:<nowiki>[[:Category:{{{1}}}|{{{2|{{{1}}}}}}]]</nowiki> | :<nowiki>[[:Category:{{{1}}}|{{{2|{{{1}}}}}}]]</nowiki> | ||
When the category ''does not exist but has elements assigned'' a "red link" will be generated: | When the category ''does not exist but has elements assigned'', a "red link" will be generated: | ||
:<nowiki>[[:Category:{{{1}}}|{{{2|{{{1}}}}}}]]</nowiki> | :<nowiki>[[:Category:{{{1}}}|{{{2|{{{1}}}}}}]]</nowiki> | ||
| Line 56: | Line 56: | ||
:[[''Category'':{{{1}}}]] or [[''Category'':{{{2}}}]] is displayed | :[[''Category'':{{{1}}}]] or [[''Category'':{{{2}}}]] is displayed | ||
:[[''Category'':<span style="color:red"><nowiki>{{{1}}}</nowiki></span>]] or [[''Category'':<span style="color:red"><nowiki>{{{2}}}</nowiki></span>]] is displayed when {{{3}}} = x | :[[''Category'':<span style="color:red"><nowiki>{{{1}}}</nowiki></span>]] or [[''Category'':<span style="color:red"><nowiki>{{{2}}}</nowiki></span>]] is displayed when {{{3}}} = x | ||
:<span style="background-color:# | :<span style="background-color:#FEDCBA"><nowiki>{{{1}}}</nowiki></span> or <span style="background-color:#FEDBCA"><nowiki>{{{2}}}</nowiki></span> will get background color when {{{3}}} = X | ||
| Line 65: | Line 65: | ||
*<tt><nowiki>{{C|not-existing-cat}}</nowiki></tt> produces {{C| | *<tt><nowiki>{{C|Category-not-existing}}</nowiki></tt> produces {{C|Category-not-existing}} | ||
*<tt><nowiki>{{C| | *<tt><nowiki>{{C|Category-not-existing|Red_Link}}</nowiki></tt> produces {{C|Category-not-existing|Red_Link}} | ||
*<tt><nowiki>{{C| | |||
*<tt><nowiki>{{C| | |||
*<tt><nowiki>{{C| | *<tt><nowiki>{{C|Not-existing-cat}}</nowiki></tt> produces {{C|Not-existing-cat}} | ||
*<tt><nowiki>{{C| | *<tt><nowiki>{{C|Not-existing-cat|display}}</nowiki></tt> produces {{C|Not-existing-cat|display}} | ||
*<tt><nowiki>{{C|Not-existing-cat|3=x}}</nowiki></tt> produces {{C|Not-existing-cat|3=x}} | |||
*<tt><nowiki>{{C|Not-existing-cat|display-cat|x}}</nowiki></tt> produces {{C|Not-existing-cat|display-cat|x}} | |||
*<tt><nowiki>{{C|Not-existing-cat|3=X}}</nowiki></tt> produces {{C|Not-existing-cat|3=X}} | |||
*<tt><nowiki>{{C|Not-existing-cat|displayname|X}}</nowiki></tt> produces {{C|Not-existing-cat|displayname|X}} | |||
| Line 79: | Line 83: | ||
*<tt><nowiki>{{C|Wikipedia:Hilfe|German help pages|de}}</nowiki></tt> produces {{C|Wikipedia:Hilfe|German help pages|de}} | *<tt><nowiki>{{C|Wikipedia:Hilfe|German help pages|de}}</nowiki></tt> produces {{C|Wikipedia:Hilfe|German help pages|de}} | ||
*<tt><nowiki>{{C|Accueil|Catégorie:Accueil|fr}}</nowiki></tt> produces {{C|Accueil|Catégorie:Accueil|fr}} | *<tt><nowiki>{{C|Accueil|Catégorie:Accueil|fr}}</nowiki></tt> produces {{C|Accueil|Catégorie:Accueil|fr}} | ||
*<tt><nowiki>{{C|Kangxi radicals||wiktionary}}</nowiki></tt> produces {{C|Kangxi radicals||wiktionary}} | |||
*<tt><nowiki>{{C|Wikcionario:Apéndices|Categoría:Apéndices|wiktionary:es}} | |||
</nowiki></tt> produces {{C|Wikcionario:Apéndices|Categoría:Apéndices|wiktionary:es}} | |||
<includeonly> | <includeonly> | ||
| Line 84: | Line 91: | ||
[[Category:Interwiki link templates|{{PAGENAME}}]] | [[Category:Interwiki link templates|{{PAGENAME}}]] | ||
[[Category:Typing-aid templates|{{PAGENAME}}]] | [[Category:Typing-aid templates|{{PAGENAME}}]] | ||
[[Category:Category-not-existing|{{PAGENAME}}]] | |||
</includeonly> | </includeonly> | ||
Revision as of 06:01, 3 July 2013
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
| 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|Internal link templates}} produces Internal link templates
- {{C|Internal link templates|}} produces Internal link templates
- {{C|Internal link templates|C:''display''text}} produces C:displaytext
- {{C|Category-not-existing}} produces Category-not-existing
- {{C|Category-not-existing|Red_Link}} produces Red_Link
- {{C|Not-existing-cat}} produces Not-existing-cat
- {{C|Not-existing-cat|display}} produces 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.
- {{C|Main||en}} or {{C|Main|3=en}} produces Main
- {{C|Wikipedia:Hilfe|German help pages|de}} produces German help pages
- {{C|Accueil|Catégorie:Accueil|fr}} produces Catégorie:Accueil
- {{C|Kangxi radicals||wiktionary}} produces Kangxi radicals
- {{C|Wikcionario:Apéndices|Categoría:Apéndices|wiktionary:es}} produces Categoría:Apéndices