Help:Templates

The UESPWiki – Your source for The Elder Scrolls since 1995
Help
Jump to: navigation, search

Templates are a commonly-used wiki tool that help to provide a uniform appearance and layout for related pages. This page describes how to use the existing templates on the site.

Quick Templates[edit]

Content[edit]

Pages with this template on them will be listed on the appropriate namespace subpage under Category:Pages Needing Cleanup.
  • Work in Progress: {{Wip}}
Placing this on an article will let others know that you are working on it over a reasonable period of time. It will also <snip>
  • editor = name of editor who placed the WIP tag
  • date = date on which WIP tag was placed
Add this template to the top of a discussion page that you wish to be reviewed by editors. Placing this on a page will place the page into the appropriate pages needing peer review category.
These two are added within the article. Please see Category:Pages Needing Verification for more info.
  • Missing Data: {{Huh}}
This should be used when an entry in a table is entirely missing.
To wikify a page means to format a page using wiki markup to make the page look better visually. Pages with this template on them will be listed on Category:Pages Needing Wikification.

Images[edit]

Not Linked: {{UnusedImage}}
  • This template is used on the image's actual page, not an article, when the image is not in use but could be.
Linked: {{UnusedImage|linked=yes}}
  • This template is used on the image's actual page, not an article, when the image is not in use but is linked to by a certain page.

Deletion[edit]

Before adding these templates, please read over the UESP's Deletion Policy.

Others[edit]

Use this template on talk pages.
This template is used to indicate that an article is too large and needs to be separated into smaller articles.
  • Merge: {{Merge|page to merge with}}
Use this template when an article does not contain a lot of information or is similar to another article. This like information can create less hassle if all relevant topics are within the same article.
Stubs are articles that contain very little information concerning the topic (often because they were just started), which should at some point be expanded.
Use one of these when an edit on a talk page/discussion is unsigned. The second version is identical to the first except that the date is placed first. This is easier when copying and pasting from the History page, Recent Changes, or a difference between two revisions.

Available Templates[edit]

The templates are all listed in a special Template namespace, i.e. their names start with "Template:". The Templates category lists the various available templates. There are a few commonly used varieties of templates:

  • Bread Crumb Trail Templates: These templates are used to add a standard "bread crumb trail" to a page, i.e., a set of links to parent pages that appears at the top of a page. On this page, for example, the "Help" link at the top of the page is its bread crumb trail (and is added using the {{Trail}} template). These templates often also put the page into any appropriate categories. In most cases, bread crumb trail templates do not take any parameters. Almost every page on the wiki uses some type of bread crumb trail template.
  • Content Templates: These templates are used to add properly formatted content to a page. They range from relatively simple templates that just add a few words to a page (such as Template:Quest Comment) to very complex templates that add large info-boxes to a page (such as Template:NPC Summary). These templates generally take parameters, which provide the information that needs to be formatted. For example, the Quest Comment template needs a parameter containing the comment to be added; the NPC Summary template takes a long list of parameters, all of which are the information that is to be displayed in the infobox.
  • Markup Templates. These templates are generally used to flag a page. For example, Template:Cleanup can be used on pages that need to be cleaned up. Adding the template to a page causes a box to appear on the page alerting readers to the page's status, and also adds the page to a category so that editors can easily find it (Category:Pages Needing Cleanup, for example). These templates often have an optional parameter, used to provide extra information about why the page has been flagged.

Basic Usage[edit]

To use a template, you place the template's name inside double "{" brackets on a wiki page. So, to use the template Template:Example, you would enter the following onto a wiki page:

{{Example}}

If you try that, for example in the Sandbox, what ends up being displayed on the page is:

This is an example of a template.

In other words, the contents of the page Template:Example get displayed wherever you use the template.

Most templates take parameters, which are added using the "|" symbol. Sometimes parameters are unnamed, in which case you just enter the information after the "|" symbol. For example:

{{Example|Example with a parameter}}

This produces:

This is an example of a template. Example with a parameter

Templates that take multiple parameters generally use names to keep track of the parameters. For named parameters, you have to enter "|", the parameter's name, an "=" sign, and then the information. For example:

{{Example|italic=Example with the italic parameter}}

This produces:

This is an example of a template. Example with the italic parameter

The exact parameters used by any template, and what is done with those parameters, depends upon the template. The template page generally provides documentation on the possible parameters. The parameter names have to be spelled and capitalized exactly as specified, or the parameter will be completely ignored. Or the template can be copied and pasted from another page that uses the template, and the information in the template modified as necessary; this is often the easiest way to start using a template.

Details[edit]

Transclusions[edit]

When you use a template on a page, the technical term for what happens is that the contents of the template get "transcluded" onto the page. This means that the template contents all appear to be copied and included into the target page. The copying process, however, is done dynamically: if the template is modified, all pages using the template are also modified. Therefore, if a decision is made to change the layout of a given template, only the template needs to be edited, instead of needing to make a change to every page that uses the template.

Transcluding can actually be done using any wiki page, not just templates. The only difference with a non-template page is that the full page name, including the namespace, has to be specified (when transcluding a template, the "Template:" part of the name is optional). Transcluding with non-templates is generally done when there is identical information that needs to be displayed on more than one page. One example is the page Oblivion:Spell List Notes; these notes are transcluded onto many pages that provide information on spells, such as Oblivion:Spells and Oblivion:Volanaro. Another example is Lore:Altmer; the general information on this race is also shown on Oblivion:Altmer and Morrowind:Altmer.

Non-Included Text[edit]

Often if you look at a template's page, you will notice a lot of text that does not appear when you use the template. This is particularly common with documentation about the template. For example, the page Template:Quest Comment shows a line of text describing the template. But {{Quest Comment|This happens if you have killed a guard}} produces just "(This happens if you have killed a guard)"; none of the documentation is displayed.

This is accomplished by using the tags <noinclude> and </noinclude>. Any text placed between those two tags is only shown on the original template, and is not shown on any pages that use the template. There is also a set of <includeonly> and </includeonly> tags. In this case, any text between those tags is only shown on pages that use the template but is not visible on the template page itself.

Parameters[edit]

For many templates, in particular content templates, parameters are a critical component: they provide the information that is to be formatted or otherwise displayed by the template. Parameters can also be used to provide options to the template, for example, specifying the color to be used for a box. Parameters can either be named or unnamed, depending upon how the template was designed.

For parameters used to specify options, there is generally a limited number of possible values to provide for the template. For example, if the parameter specifies a color then the value has to be a recognized color. On the other hand, parameters that provide information to be shown on a page can generally take almost any text, including links and formatting.

If a template takes unnamed parameters, they are specified by simply using the "|" symbol. Multiple unnamed parameters can be provided to a single template, in which case each parameter starts with a new "|" symbol. The order of the parameters is critical for unnamed parameters: the only way the template can tell them apart is based on the order. Internally, unnamed parameters are referenced using numbers. So {{{1}}} within a template is used to insert the contents of the first parameter.

The other way a template can be designed is to use named parameters, in which case each parameter is specified using "|name=", where name is the paramter's name. This approach is particularly common for templates that take multiple parameters, because it is easier to keep track of many parameters when each has an appropriate name. The order of named parameters does not matter. In many templates, some (or all) of the parameters are optional; optional parameters can simply be left out of the list unless needed.

Substituting[edit]

There are some cases where you may want to truly insert the contents of a template into a page, instead of just transcluding the contents. Sometimes this is done to ensure that the page is not modified if the template is subsequently changed (for example, if you want to post a warning on a user's page, it is generally best to substitute the template so that the warning does not get altered). Another reason is to make the page simpler and easier to load for the server; this is particularly true of the Template:Daedric template used to display daedric lettering, which should always be substituted.

In order to substitute a template, you simply insert the text subst: at the start of the template. For example,

{{subst:Example}}

The substitution happens when you save the page (but not when you preview the page). The page looks identical to readers, but if you edit the page you will see that the template no longer exists, but instead has been replaced by the appropriate contents.

See Also[edit]