Jump to content

Template:Template link/doc: Difference between revisions

From TheOpenRoad Support
+Cat
 
m 1 revision imported
 
(No difference)

Latest revision as of 15:30, 19 June 2025

Template:Template shortcut

The template link template is a simple macro template used to display a template name as a link surrounded by braces, thus showing the template name as code rather than actually invoking it. Its primary use is in instruction and documentation where it is used to refer to a template by name without invoking it.

Note that this template may be used under the name "tee-el" (tl) as well as "tee-one" (t1)— both function the same way and produce the same results. This is not true for all such visually confusing templates containing a possible 1/l mix-up as they are not interchangeable.

Template:Tl works exactly like Template:Tl with the addition of optionally displaying alternative label text (link label). Template:Tl can include the use of parameters in the template (as {{{1}}}).

Examples[edit source]

A short example of its use is:

{{tl|Example}}
which generates
Template:Tl

Other longer examples:

Code Result Notes
{{tl|Void}} Template:Tl Standard usage
{{tls|Example}} Template:Tls For templates that should be substituted
{{tl2|X1}} {{X1}} This formats the link to show how it would look in code (i.e., monospace font)
{{tl2|sister=M:|3x}} {{3x}} Same as above, for templates on another Wikimedia project (in this example, Meta, using m:). See Interwiki codes.
{{tl2|sister=wikibooks|lang=de:|WP}} {{WP}} For templates on another language project
{{tl|1==)}} Template:Tl Use the format {{tl|1=templatename}} if the template contains template coding characters such as Template:Tl or Template:Tl

TemplateData[edit source]

Template:TemplateData header <templatedata>{ "description": "This template displays a template name as a link surrounded by braces, thus showing how the template name would be used in code. Its primary use is in instruction and documentation.", "params": { "1": { "label": "Template name", "description": "Positional parameter: the template name without the namespace prefix “Template:”, which is added automatically", "type": "wiki-template-name", "required": true } }, "format": "inline" }</templatedata>

See also[edit source]

Template:Navbar

General-purpose formatting[edit source]

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 Linked with alternative text
{{tlg}} options[note 1]
to achieve link style
DEFAULT <syntaxhighlight lang="text" class="" style="" inline="1">nolink=yes</syntaxhighlight> <syntaxhighlight lang="text" class="" style="" inline="1">subst=yes</syntaxhighlight> nolink=yes|subst=yes <syntaxhighlight lang="text" class="" style="" inline="1">braceinside=yes</syntaxhighlight> <syntaxhighlight lang="text" class="" style="" inline="1">alttext=Foo</syntaxhighlight>
<syntaxhighlight lang="text" class="" style="" inline="1">2=Foo</syntaxhighlight>
normal DEFAULT Template:Nowrap[note 1]
Template:Tl
Template:Tlp[note 2]
{{Template:tlu}}[note 3]
{{tlf}}[note 2]
<template link>
Template:Tls
{{subst:Template:tlsu}}[note 3]
{{subst:tlsf}}[note 2]
<template link>
{{tn}} {{tla}}
code <syntaxhighlight lang="text" class="" style="" inline="1">code=yes</syntaxhighlight> {{tl2}}
{{tlx}}
{{Template:tlxu}}[note 3]
Template:Tlc[note 2]
<template link>
{{tnull}}<template link>
{{subst:tlxs}} {{subst:tlsc}}[note 2]
<template link>
monospace <syntaxhighlight lang="text" class="" style="" inline="1">plaincode=yes</syntaxhighlight>[note 4] {{subst:tltss}}[note 5]
kbd <syntaxhighlight lang="text" class="" style="" inline="1">kbd=yes</syntaxhighlight>[note 5]
bold <syntaxhighlight lang="text" class="" style="" inline="1">bold=yes</syntaxhighlight> {{tlb}}
bold+code bold=yes|code=yes {{tlxb}}
italic+code italic=yes|code=yes {{tlxi}}

Template:Reflist

Other formatting templates[edit source]

Templates producing specialised formatting effects for given templates, modules or parameters
Code example Effect Notes
Template:Tlx
  1. REDIRECT Template:Template journal
|| Supports colors, placeholder texts, named and unnamed parameters

<source lang="wikitext"> <syntaxhighlight lang="wikitext">

</syntaxhighlight> </source>

<syntaxhighlight lang="wikitext">

</syntaxhighlight>

Same as above
Template:Tlx {{Hatnote|Some text|selfref=yes|category=no|lang=fr}} Supports colors, placeholder texts, named and unnamed parameters
Template:Xtag{{Hatnote|Some text|selfref=yes|category=no|lang=fr}}Template:Xtag <syntaxhighlight lang="wikitext" inline></syntaxhighlight> Same as above
Template:Tlx {{hatnote}} Supports linking to sister projects (e.g., fr:Hatnote)
Template:Tlx lang=fr|Some text}}</syntaxhighlight> Shows code and example
Template:Tlx Template:Hatnote Produces a normal link to the template
Template:Tlx
Template:Tlx
[[Template:Hatnote]]
[[Template:Hatnote|Hatnote]]
Formats wikilink, with optional piped link text and blended suffix
Template:Tlx {{#invoke:Example|hello}} Counterpart to Template:Tl for linking to Lua modules
Template:Tlx {{#invoke:Example|hello}} Similar to Template:Tl, but expects the function to be documented and creates a link to the corresponding section
Template:Tlx {{#invoke:Example|hello}} Counterpart to Template:Tl for linking to Lua modules
Template:Tlx <syntaxhighlight lang="lua" inline="1">require('Module:Example')</syntaxhighlight> Link to Lua modules and built-in libraries, showing Lua code.
Template:Tlx Template:Para Formats template parameters for display, with or without values
Template:Tlx [[WP:LASTING]] Takes a shortcut suffix in project namespace and displays it with brackets and the WP: alias in a [[WP:CODE|Template:Tag]] tag.
Template:Tlx
Template:Tlx
Template:Tag
Template:Xtag
Formats [X]HTML tags; can add content, choose opening, closing, or self-closing
Template:Tlx {{d:Ping project}} Wikidata counterpart to Template:Tl
Template:Tlx
Template:Tlx
{{#if}}
{{#if:{{{1}}}|true|false}}
Parser function equivalent to Template:Tl
Template:Tlx {{uc:}} Magic word links

With utility links[edit source]

Templates producing utility links for a given template (Hatnote used here as example)
Code example Effect
Template:Tlx Template:Hatnote (edit | talk | history | links | watch | logs)
Template:Tlx Template:Hatnote(edit talk links history)
Template:Tlx Template:T links/sandbox links Template:Yesno
Template:Tlx Template:Hatnote (talk · history · transclusions · logs · subpages)
Template:Tlx {{Hatnote}}
links talk edit
Template:Tlx {{subst:Hatnote}}
 links talk edit
Template:Tlx Template:Hatnote (talk⧼dot-separator⧽links⧼dot-separator⧽edit)
Template:Tlx Template:Hatnote (talk links edit)
Template:Tlx m:Template:Hatnote (backlinks edit)
Template:Tlx Template:Hatnote (backlinks edit)
Template:Tlx {{Hatnote}} (talk)
Template:Tlx Template:Hatnote (links, talk)
Template:Tlx Template:Hatnote (links, talk)



Cite error: <ref> tags exist for a group named "note", but no corresponding <references group="note"/> tag was found