September 2nd, 2019 💤 Wiki Weekly #22! 🛌

We're less than 3 weeks away from the release of Link's Awakening for Nintendo Switch!
Let's contribute on pages related to that! Take a look!

Latest Announcements

Help:Templates

From Zelda Wiki, the Zelda encyclopedia
Jump to: navigation, search
ZW Logo White.png
Getting Involved Getting Involved.png
Getting Involved
Zelda Wiki:Forum Recent News.png
Forum
Discussion Center OoT Navi.png
Discussion Center
Image edit request and support center TWWHD Fishman Artwork.png
Image Alteration
Image retrieval request and support center Picto Box TWW.png
Image Retrieval
Guidelines and Policies Book of Mudora.png
Help Guide


See also: Help:Templates on MediaWiki

A template is a page made to be included in other pages. They standardize content or formats that need to be repeated on many pages, by encapsulating them in a separate page in the Template namespace. They can abstract away complicated syntax, namely parser functions.

Templates are most often used by transclusion. That is, by enclosing the name of the template page in {{double curly brackets}}. When placed in another page, the entire contents of that template page will be displayed where you placed it. Templates can have parameters that modify their appearance or content.

An example of a common template is an infobox, such as Template:Infobox Item. Infobox templates appear in the upper right corner of nearly every article on the wiki. There are many other types of templates.

Using Templates

Parameters

Templates can have anonymous parameters, named parameters, or both. With anonymous parameters, order matters.

Template:Item Amount is a template with anonymous parameters. It is used like this: {{Item Amount|SS|3|Ancient Flower}}, which produces SS Ancient Flower Icon.png × 3 Ancient Flowers. You wouldn't get the right output if you changed the order of the parameters.

Template:Clarify is a template with both anonymous and named parameters. It is used like this: {{Clarify|BotW|reason= Some text here}}. There's one anonymous parameter for the game, and a named reason parameter for the display text.

Transclusion and substitution

Templates can be used by transclusion or by substitution. When you transclude a template on a page and save it, the source will still show {{<Template name>}} when you go back to edit it. Conversely, when you substitute a template, the actual contents of the template gets copied and saved to the page.

Transclusion vs. substitution after saving the page
Input Output view Output source
{{MM}} Majora's Mask {{MM}}
{{subst:MM}} Majora's Mask ''[[The Legend of Zelda: Majora's Mask|Majora's Mask]]''

In reality, Template:MM outputs something quite different when substituted, but this illustrates the point.

Generally, templates should be substituted and not transcluded. Substitution does not preserve a reference to the template—it's like you didn't use a template at all. You lose the ability to have the content update automatically when you change the template.

Making Templates

For information on how to make templates, see Zelda Wiki:Making Templates.