Heroes of the Storm Wiki

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. {{Template name}}.

Using templates[]

You can insert a template into a page using the {{Template name}} syntax. An example of a simple template is the {{times}} template. When used, it inserts the × symbol into a page. You can use the earlier syntax to insert this symbol into any page. For example, the syntax 5 {{times}} 6 = 30 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 {{main|[[Template:Main]]}} produces

Main article: [[:Template:Main|Template:Main]]

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 {{ambox|info = This is a test of the ambox template}}, 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 {{ambox|type = This is a test of using multiple parameters|info = In this example, multiple variables are fulfilled.}}

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. {{main|a{{=}}b}}.
  • 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. {{main|a{{!}}b}}.
  • You can refer to unnamed parameters as 1, 2, 3, etc. depending on where they come in the template. So {{main|test}} is the same as {{main|1=test}}.
  • 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 {{{Parameter Name}}}. Named parameters have their exact name placed as the parameter name. Unnamed parameters are referenced as {{{1}}} for the first unnamed parameter, {{{2}}} for the second, {{{3}}} 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, {{{Parameter Name|No value}}} 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. {{{Parameter Name}}}.

Heroes of the Storm Wiki Help Contents
Guidelines_ _Manual of StyleImages (GuidelinesLicensing)
Using MediaWiki_ _EditingStarting a new pageTemplates (Maintenance templates)
Contributor Customization_ _Signatures