Help:Templates

A template is a page created for the purpose of being included in other wiki pages. Templates contain repetitive or standardized material that may need to be included on multiple pages and is more convenient to be edited and stored in a single source. Templates are commonly used for alert messages, infoboxes, navigational boxes, and other similar purposes, as well as for standardized information.

The most common method of using templates is through transclusion, which inserts the content from one wiki page into another in real time. The standard method of transclusion is through the use of curly braces with the template or article name inside, e.g..

Using templates
You can insert a template into a page using the  syntax. An example of a simple template is the times template. When used, it inserts the &times; symbol into a page. You can use the earlier syntax to insert this symbol into any page. For example, the syntax  produces 5  6 = 30.

Most templates have parameters, which are variable information that can be inserted into the template when used. Parameters can either be named or unnamed. Parameters are separated from each other and the template name by the pipe (|) symbol. Named parameters can be specified by giving the name followed by an equals sign (=) followed by the parameter value. The template, main uses an unnamed parameter. In this case, the syntax  produces

Named parameters have to be specified by name. An example of a template with named parameters is the ambox template. To use the info parameter, it needs to be specified with the syntax, which produces

Any number of named or unnamed parameters can be specified by adding more pipes. For example, if you were to use the syntax

Hints and workarounds

 * It's not possible to use an equals sign in an unnamed parameter, as it would register as being used as part of the name. The = template can be used to insert an equals sign into an unnamed parameter, e.g..
 * Likewise, it's not possible to use an ordinary pipe character inside a template, such as to create a table using wikitable format. To work around this, you can use the ! template, e.g..
 * You can refer to unnamed parameters as 1, 2, 3, etc. depending on where they come in the template. So  is the same as.
 * Unnamed parameters do not strip whitespace from either side of their values, but named parameters do.

Creating templates
Templates can be created and edited in the same way as any other page. Most templates exist inside the Template: namespace. For example, Template:Infobox. The content on a template page is completely transcluded into the page it is placed in, including any other templates placed inside the template. You can create a template from scratch, or you can use a metatemplate to help you make one.

Handling parameters
The general syntax for parameters are three curly braces around the parameter name, or. Named parameters have their exact name placed as the parameter name. Unnamed parameters are referenced as for the first unnamed parameter,  for the second,  for the third and so on. They can also be referenced by these names like any other named parameter as well.

Parameters can be given a default value by adding a pipe. The default value will be displayed if no value is given for the parameter. For example,  gives the text No value if a value isn't specified for the parameter Parameter Name. Unnamed templates can be given default values the same way. If no default value is specified, the parameter syntax will be used if no value is given, e.g..