From Wikimedia Commons, the free media repository
Jump to navigation Jump to search


Template documentationview · edit · history · purge ]
This documentation is transcluded from Template:Tlc/doc.

This is the {{tlc}} template.

This page also serves as the full documentation for {{Tlf}} (doc page), that works almost exactly the same.

When showing a template name with brackets in documentation you have to escape the brackets in some way so it doesn't become a call to the template. Instead of using <nowiki></nowiki> tags you can write it simpler and shorter by using these templates.

Here is how these templates look. Code to the left and actual rendering to the right:

{{tlc|name|parameters}} = {{name|parameters}}
{{tlf|name|parameters}} = {{name|parameters}}

These templates work similarly to {{Tl}} and {{tlx}}, but they don't make the template name into a link. When writing documentation you might want to avoid a lot of unnecessary links, since it decreases readability. So on the first occurrence of a template name use {{Tl}}, {{tld}} or {{tlx}}, and then use {{tlc}} or {{tlf}}.

Features of {{tlc}}, {{tld}}, {{tlf}} and {{tlp}}:

  • They show a template name and up to eight parameters.
  • They also show empty parameters. (See examples below.)
  • They prevent line wraps in their output.



Wikitables make the <code></code> tags transparent, that's why the "code colouring" is missing in these examples.

{{tlc}} {{{{{1}}}}} Shows its own syntax.
{{tlc|name}} {{name}}
{{tlc|name|one}} {{name|one}}
{{tlc|name|one|two}} {{name|one|two}}
{{tlc|name|a|b|c|d|e|f|g|h|i|j}} {{name|a|b|c|d|e|f|g|h}} Shows up to eight parameters. The rest are dropped.
{{tlc|name|||three|four}} {{name|||three|four}} Also shows empty parameters.
{{tlc|name|||three||}} {{name|||three||}} Even shows empty parameters that come in the end.
{{tlc|name|one=a|two=b}} {{name}} Equal signs is a problem, but there is a fix.
{{tlc|name|2=one=a|3=two=b}} {{name|one=a|two=b}} Use numbered parameters to fix it. Remember to start from 2, since the "name" is number 1.

If you have equal signs in your template parameters, you should replace them with {{=}}, but it probably is simpler and clearer to code it using <nowiki> tags etc. Here are the codes to emulate {{tlf}} and {{tlc}} respectively. Code to the left and actual rendering to the right:

  • <span class="nowrap"><nowiki>{{name|one=a|two=b}}</nowiki></span>{{name|one=a|two=b}}
  • <code class="nowrap"><nowiki>{{name|one=a|two=b}}</nowiki></code>{{name|one=a|two=b}}


<templatedata>JSON</templatedata> ./. {{TemplateBox}}

TemplateData is a way to store information about template parameters (the description of those and of the whole template) for both humans and machines. It is used by VisualEditor and possibly other tools like Upload Wizard.

Existing template documentation
At Wikimedia Commons, it is recommended to use {{TemplateBox}} with either ‎useTemplateData=1 or ‎useTemplateData=only on the ‎/doc subpage and transcluding it with {{Documentation}} into the template. ‎<nowiki>-tags can be wrapped around the arguments, if required, to avoid templates being expanded.

Newly created template documentation and imports
Another option, especially for imported templates, or for users with JSON experience, is placing raw ‎<templatedata>-tags into the Wikitext of the template, as described in various Wikipediae.

There is an ongoing discussion about that matter. Feel invited to comment if you are experienced in either way, your time permits and if you like to share your opinion or to make a suggestion.

Wikipedia's help about TemplateDataCommons-specific information

Template link code

Template parameters[Edit template data]

This template prefers inline formatting of parameters.


Linked template name

Parameter 12

First parameter value

Parameter 23

Second parameter value

Parameter 34

Third parameter value

Parameter 45

Fourth parameter value

Parameter 56

Fifth parameter value

Parameter 67

Sixth parameter value

Parameter 78

Seventh parameter value

Parameter 89

Eight parameter value


[edit subpage]

List of templates using {{T/main}}
Code Result Notes lock


{{Example}} makes brackets part of the link; see docu


Example just link, without the brackets; see docu


{{Example}} inner brackets are part of the link; see docu


{{Example}} brackets are not a part of the link; see docu


{{Example}} makes brackets around the link; see docu


{{subst:example}} no parameters, adds "subst:"
Templates showing parameters 0 Meta template {{Tle}} is easiest to parametrize.


{{ F | 1 = v1 | 2 = v2 | 3 = v3 }} decribes template parameters by names and values


{{example|1|2|3|4|5|7|8|...}} up to 8 parameters

{{Tlf|example|1|2|3|...up to 8}}

{{example|1|2|3|...up to 8}} up to 8 parameters, no link; see docu

{{Tlc|example|1|2|3|4|||7|up to 8|9}}

{{example|1|2|3|4|||7|up to 8}} up to 8 parameters, no link, <code> style


{{example|1||2|3||}} up to 8 parameters, <code> style; see docu


{{User:Example}} like {{tl}} but for any namespace


{{subst:User:Example}} like {{tlr}}, but also adds "subst:"
Alternative forms 0 These ignore empty parameters.


{{example|1|2|3|4|5|7|8}} up to 8 parameters; ignores empty parms


{{example|p1|p2}} up to 2 parameters, <code> style; see docu


{{subst:example|1|2|3|4|5|6|7|8|...}} up to 8 parameters, adds linked "subst:"; see doc


{{subst:example|1|2|3|4|5|...}} up to 5 parameters, adds linked "subst:", <code> style

General-purpose formatting

Comparison of template-linking templates according to the styles of generated text and link produced
Text style ↓ {{tlg}} options[note 1]
to achieve text style
Link style
Linked Unlinked Linked with subst Unlinked with subst Linked including braces
{{tlg}} options[note 1]
to achieve link style
N/A DEFAULT nolink=yes subst=yes nolink=yes|subst=yes braceinside=yes
normal DEFAULT N/A
code code=yes
monospace plaincode=yes[note 4] N/A
kbd kbd=yes[note 5]
  1. a b c {{tlg}} is the most general template, allowing any combination of text style and/or link style options.
  2. a b c d e Prevents wrapping of text by placing it inside <span class="nowrap">...</span> tags.
  3. a b c Allows links to templates in any namespace.
  4. {{tlg|plaincode=yes}} uses <code style="border: none; background-color: transparent;">...</code>.
  5. a b c d Displays monospaced font using <span style="font-family: monospace;">...</span>.