help


At their most basic, templates are basically just wiki pages whose content may be pulled into other pages. In other words, all the content you see when viewing a page may not actually be in the page source. Some or even all of it may be in templates.

Three very common types of templates are shown here as examples:


Speaking generally, a template is any wiki page whose content is designed to be transcluded (embedded) inside other pages. Templates follow a convention that the name is prefixed with Template:, assigning it to that namespace.

Templates in the page source

When editing wiki pages, it is likely you might encounter something like this:

{{Example}}

Or perhaps something more complex like this:

{{Infobox
|name = Example infobox
|image = Curse hydra.png
|race = Plushie
|location = Curse Headquarters
|source = [[User:Encredechine{{!}}Encredechine]]
|related = Fun
}}

These are examples of templates being used on these wiki pages. The first is using [[Template:Example]], the second is using [[Template:Infobox]]. The double curly brackets, {{ and }} usually mean that a template is being used there, but unfortunately, double curly brackets also have other uses in wikitext, which can cause some confusion.

Templates can also use lua to run faster.


How to tell if it's a template

Let's look at our examples above again.

{{Infobox
|name = Example infobox
|image = Curse hydra.png
|race = Plushie
|location = Curse Headquarters
|source = [[User:Encredechine{{!}}Encredechine]]
|related = Fun
}}

In this case, we have a definite clue because the first thing after the name other than just space is a pipe character: (|). This is definitely a template. If it were a colon instead, (:), then it would not be a template, but some kind of magic word.

{{Example}}

Unfortunately, this one doesn't offer any definite clues right off the bat. If you aren't sure, there are a few ways to make a pretty good guess:

Basic transclusion

See: Mw:Help:Transclusion

Transclusion is by far the most common way to use templates.

In fact, an ordinary wiki page can also be used as a template, simply by specifying the namespace in which it resides, so:

If no such namespace exists, the full title is assumed to be a template:

There are other ways of using templates, but these are useful only in special situations. Most editors will never have any use for these special functions, so they are explained only at the bottom of this page.

Template documentation

Many template authors provide documentation for how to use specific templates. This can usually be found on the template page itself. If you are editing a page using a particular template, one way you can usually get to the template page quickly is by using the "Templates used on this page" section at the bottom of the edit page.

Unfortunately, many templates are not documented. In this case, you can try looking for examples of the template being used on other pages. From the template page, try clicking "What links here" in the "Tools" menu in the sidebar to find other pages where the template is used. If it's not documented, consider writing your own template documentation.

It can help to understand how to write templates. Once you do, you may be able to figure out a template simply by opening it for editing and looking at its source, but templates can be very complex and may use advanced wiki features or specific extensions, like any other wiki page. If all else fails, never hesitate to ask for assistance from the wiki community.

Alternate ways to use templates

In addition to standard transclusion, templates can be used in other pages in these ways:

See also