Parameters
An include can pass values into the included page. Parameters are separated by pipes; the included page reads them with triple braces.
Passing parameters
Positional parameters are just values, counted from 1:
{{Colorlink|Rome|crimson}}Named parameters use name="value" — the value in quotes:
{{Collapse|text="Spoilers below"}}The quotes are the engine’s convention for named values, and the editor’s
checker enforces them. They earn their keep: a quoted value may contain pipes
and equals signs freely (text="a | b = c"), and \" puts a literal quote
inside.
Rules worth knowing:
- Whitespace around names and values is trimmed:
{{Greet| hi }}passeshi. - A positional value cannot contain a bare
=— the first=turns the part into a named parameter. Passing a URL positionally? Name it by its number instead, unquoted:{{Link|1=https://example.com?a=b}}. - An empty value is a real value:
{{Box|title=}}passes an empty title (which overrides a default — see below). - If the same name is given twice, the last one wins.
- Values may themselves be includes:
{{Box|content={{Other page}}}}rendersOther pageand passes the result.
Reading parameters (template authors)
Inside the included page, triple braces substitute the value:
{{{1}}} the first positional value
{{{title}}} the named value "title"
{{{title|News}}} with a default when the caller didn't supply one- A parameter that was supplied but empty beats the default:
{{Box|title=}}renders an empty title, not “News”. - A parameter that was not supplied and has no default renders as nothing.
- Defaults can nest:
{{{3|{{{1}}}}}}means “the third value, or else the first” — the stockColorlinktemplate uses exactly this to make its label optional.
Implicit parameters
The engine injects two parameters into every include, mainly for templates
that generate HTML ids:
| Parameter | Value |
|---|---|
{{{_caller}}} | A slug of the including page’s title — the same for every include on that page. |
{{{_uid}}} | The caller slug plus a counter — unique per include, and it cannot be overridden. |
{{{_uid}}} exists because DOM ids must be unique: the stock Collapse
template keys its show/hide toggle on it, so seven collapses on one page get
seven working toggles.
Different from MediaWiki: named values are quoted (name="value"), and
there are no parser functions — no {{#if:}}, no {{#switch:}}. Template
logic stays declarative: parameters, defaults, and nesting.