Jump to content

Template:Tl

Page semi-protected
From Wikidata
Documentation icon Template documentation[view · edit · history · purge ]

The {{Tl}} or template link template is a simple macro template used to display a template name as a link surrounded by paired braces, showing how the transclusion would be performed in a page's wikitext. Its primary use is in instruction and documentation.

Usage

Use this template to show a use case for a template, e.g. {{Tl|Welcome}} produces {{Welcome}}.

Parameters

Up to nine (9) additional parameters may be supplied to this template which then appear again as sample parameters to the linked target page, e.g. {{Tl|Welcome|example}} produces {{Welcome|example}}.

If these additional parameters are intended to be shown with defined values as well, then one of two methods for doing so must be employed:

  1. All of the equality symbols between the parameter names and their values must be escaped in some way, either as {{=}} or one of the character's HTML entity representations: =, = or =. Example:
    {{Tl|Welcome|para1{{=}}yes|para2=no|para3=on|para4=off}}
    
    …which produces {{Welcome|para1=yes|para2=no|para3=on|para4=off}}.
  2. All of the examples must be defined as named rather than unnamed parameters, as in the case of…
    {{Tl|Welcome|2=para1=yes|3=para2=no|4=whoknows=sure}}
    
    …which produces {{Welcome|para1=yes|para2=no|whoknows=sure}}.

Parameter value semantics

Despite which method is ultimately used, it is highly recommended that correct semantics be used whenever documentation is being created. This means that example parameter values that only act as placeholders, indicating that a parameter should have some value but not the exact one shown, should always be wrapped inside the {{Var}} template. This provides a visual indication by showing the value in italic text, which is how modern web browsers interpret the semantic HTML <var>…</var> tags. Those tags also make that same contextual information available to those using assistive technologies such as screen readers, which will announce them as a representation of a variable and not an example for verbatim use.

Repeating the most recent example from above, assuming that the first two parameters are intended to show actual, real world usage, while the final parameter was included with a value only to show that a value of some kind should be present, the correct use of this template would be…

{{Tl|Welcome|2=para1=yes|3=para2=no|4=whoknows={{Var|sure}}}}
…for which the resulting output then becomes {{Welcome|para1=yes|para2=no|whoknows=sure}}.

TemplateData

This is the TemplateData documentation for this template used by VisualEditor and other tools.

Tl

Shows a wikilink formatted as a template call (wrapped in paired braces) with up to nine (9) example parameters

Template parameters[Edit template data]

This template prefers inline formatting of parameters.

ParameterDescriptionTypeStatus
Link target1

The pagename to link to and show as formatted as a wikitext template transclusion, Template: namespace is inferred if absent

Example
Documentation
Page namerequired
Example parameter 12

Displayed after the linked page prefixed by a vertical bar ("pipe") character, demonstrating the presence of a template parameter; if a value is also shown, the equality symbol must be escaped

Example
parameter1
Lineoptional
Example parameter 23

Displayed after the linked page prefixed by a vertical bar ("pipe") character, demonstrating the presence of a template parameter; if a value is also shown, the equality symbol must be escaped

Example
parameter2{{=}}value
Lineoptional
Example parameter 34

Displayed after the linked page prefixed by a vertical bar ("pipe") character, demonstrating the presence of a template parameter; if a value is also shown, the equality symbol must be escaped

Example
parameter3&equals;true
Lineoptional
Example parameter 45

Displayed after the linked page prefixed by a vertical bar ("pipe") character, demonstrating the presence of a template parameter; if a value is also shown, the equality symbol must be escaped

Example
parameter4&#61;false
Lineoptional
Example parameter 56

Displayed after the linked page prefixed by a vertical bar ("pipe") character, demonstrating the presence of a template parameter; if a value is also shown, the equality symbol must be escaped

Example
parameter5&#x3d;
Lineoptional
Example parameter 67

Displayed after the linked page prefixed by a vertical bar ("pipe") character, demonstrating the presence of a template parameter; if a value is also shown, the equality symbol must be escaped

Lineoptional
Example parameter 78

Displayed after the linked page prefixed by a vertical bar ("pipe") character, demonstrating the presence of a template parameter; if a value is also shown, the equality symbol must be escaped

Lineoptional
Example parameter 89

Displayed after the linked page prefixed by a vertical bar ("pipe") character, demonstrating the presence of a template parameter; if a value is also shown, the equality symbol must be escaped

Lineoptional
Example parameter 910

Displayed after the linked page prefixed by a vertical bar ("pipe") character, demonstrating the presence of a template parameter; if a value is also shown, the equality symbol must be escaped

Lineoptional
Show substitutedsubst

When assigned any non-null value, the link will be show prefixed with 'subst:', indicating substitution rather than transclusion

Booleanoptional

See also

  • {{Template link general}} – a much more versatile version of this template, implemented in Lua
  • {{Template link universal}} – for demonstrating transclusions of target pages from any namespace, not just Template:
  • {{Template link with parameters}} – also handles example parameters with values, e.g. {{SubclassTree|item=Q5|Q1}}
  • {{Tla}} – generates link formatted as template call, but allows custom link text to be shown in place of target page name
  • {{Tls}} – show links as substitutions (similar to this template when used with |subst=yes → {{subst:Tl}}), but with subst: linked to Wikipedia:Substitution for documentation pages
  • {{Para}} – for showing bare template parameter examples, typically within template or module documentation

General-purpose formatting

Comparison of template-linking templates according to the styles of generated text and link produced
{{Tlg}} options[1]
to achieve text style
{{Tlg}} options to achieve link style[1]
Linked
DEFAULT
Unlinked
nolink=yes
Linked with subst:
subst=yes
Unlinked with subst:
nolink=yes+subst=yes
Linked inc.
inner braces
braceinside=yes
Linked with
custom text
alttext=Foo
Normal
DEFAULT
{{Tl}}
{{Tlg}}[1]
{{Tlp|1|2|…}}[2]
{{Tlu}}[3]
{{Tlf}} {{subst:Tls}}
{{subst:Tlsp}}
{{subst:Tlsu}}[3]
N/A {{Tn}} {{Tla}}
(e.g., {{Foo}})
Code
code=yes
{{Tl2}}[4]
{{Tlx}}
{{T… l… expanded}}
{{Tlc}}
{{Tnull}}[link]
{{subst:Tlxs}} {{subst:Tlsc}} N/A
Monospace (<kbd>)
kbd=yes[5] or
plaincode=yes[6]
N/A
  1. ↑ 1.0 1.1 1.2 {{Tlg}} is the most general template, allowing any combination of text style and/or link style options.
  2. ↑ 2.0 2.1 2.2 2.3 Prevents wrapping of text by placing it inside tags.
  3. ↑ 3.0 3.1 Allows links to templates in any namespace.
  4. ↑ Supports interwiki links to templates on Wikimedia sister projects.
  5. ↑ Displays monospaced font using <span style="font-family: monospace;">…</span>.
  6. ↑ {{Tlg|plaincode=yes}} uses <code style="background-color: transparent; border: none;">…</code>]].

Other formatting templates

Templates producing specialised formatting effects for given templates, modules or parameters
Code example Effect Notes
{{Hatnote|Some text}}
Some text
Used to create notes that appear at the tops of pages or sit just under section headers
{{Module link|Age|age_generic}} {{#invoke:Age|age_generic}} Counterpart to {{Tl}} for linking to Lua modules
{{Para|title|book_title}} |title=book_title Formats template parameters for display, with or without values
{{Tag|ref}} <ref>…</ref> Formats HTML tags; can add content, choose opening, closing, paired or self-closing
{{Parameter|foo}} foo Formats code so that it can be easily distinguished from running text
{{Magic word|uc:}} {{uc:}} Magic word links
{{Lts|Q}} Template:Q (edit talk links history) Links to template plus others to edit, Talk page, WhatLinksHere and history
{{Tml3|Q|bracket=square}}

[[Q]]

Offers choice of wrapping characters for template link: curly braces, square brackets or none
{{Lte|Q}} {{Q}}
{{T|Q}} Q