Wikipedia:WikiProject User warnings/Help:Template coding
Appearance
Wikipedia:WikiProject User warnings/t/documentation-header
Template coding guidelines
Parameters
- Default values
Nearly all parameters should have a default value, such that misuse does not break the template; exceptions can be made for extra parameters. You can set the default value of a parameter by using piped syntax (
{{{1|default value}}}
). For example, the template below takes a parameter which expects the user to supply the proper pronoun (she, he, it, they, et cetera).{{{1|They}}} are cool.Supplied the pronoun with{{template|He}}
, the template will expand to "He are cool" (grammar aside). Ignoring the parameter with{{template}}
, the template will default the value and expand to "They are cool".
- Expert syntax
Where use could conceivably include symbols that break templates (notably the pipe (|) and equals sign (=)), an expert syntax should allow this. In such cases, an expert syntax and simple syntax can coexist as needed. For example, let us say we for some reason want to make a wikilink template.
[[{{{1}}}]]
Usin