Help:Template
More actions
| This article is part of a series on |
| Wiki Contribution |
General
|
Tools
|
Miscellaneous
|
The wiki has a variety of templates that help aid user readability, navigability, functionality and aesthetic. This page will serve to attempt to outline all of these categories, as well as templates within them. Any wiki user can create or edit a template, but keep in mind that editing a template will affect how the template appears on all pages that it has been transcluded to.
What is a Template?
A template is reference material that has been transcluded (see Wikipedia:Help:Transclusion for more information on how transclusion works) onto another page for easy repetition of information or functionality. For example, the Template:Meme sidebar allows for easy user navigability to other Memes or Category:Memes (see Wikipedia:Help:Categories for more information on categories) that might be useful to the end user in order to reduce their interaction with otherwise "messy" pages (primarily category pages which some users might find difficult or confusing to utilize.)
How do I use Templates?
Templates are always identified by a set of an opening and closing pair of double curly brackets (i.e. {{ and }}) to indicate the start and stop of the template. Both pairs of brackets are required for the template to function. A full example of how a template could be written is as follows:
{{WIP}}. The WIP Template is used to denote that a page is under heavy writing, restructuring, or is otherwise incomplete and may be difficult to parse if read. When properly typed into a page, it will display as follows:
|
Here you can see that the template strategically uses color, an icon, as well as boldened text to draw the attention of the reader to it before proceeding with the article. It's important to use templates strategically as they may not always be necessary.
Parameters
Un-named Parameters
There is another component to most templates, which are parameters. Parameters allow you to define certain aspects of a given template provided they have been written into the template; for example, the Color Template is used to easily change the color of text (such as on the Flairs article) in order to change the color of different flair names, and has four un-named parameters. Un-named parameters have no assigned word-value and thus must be entered in order as written in the template. The color template for example has the four following parameters that are common in many templates:
Parameter 1
The color of the text. For any template with a color parameter, you can use HTML pre-specified colors, HEX codes (i.e. #a0a, #00aaff, etc.), HSL/HSLA (i.e. hsla(50, 45%, 20%, .2)) Be sure to consider accessibility of selected colors if you do use them, as color-blind users may have difficulty reading certain color combinations, and some users may use non-standard wiki themes (such as the citizen theme), custom wiki themes, or browser plugins that may invert or change the color on the page.
Parameter 2
The color of the highlight. Not as common. Considerations above still apply.
Parameter 3
The size of the highlight. Many templates will let you control the size of an element within it. For example, Template:Color allows you to highlight text, and optionally make the highlight larger, or even obnoxiously large. Be sure to consider the resizing of any elements for cleanness as well as consider display on mobile devices. For size parameters, you can use percentages (i.e. "50%"), pixels, (i.e. "50px") or CSS units like "em", "rem", etc.
Parameter 4
The text. This is one of the most common parameters in any given template, as most templates on the wiki are used to preserve a certain "style" (for example, Template:Mbox is a base template for Template:WIP, Template:Stub, and Template:Expand Section).
Using a template with un-named parameters
Templates with un-named parameters are about as common as templates with named parameters, so it's important to know how they function. Typically a template that is meant to be in-line (as in, in-line with the text and not it's own separate element) will have un-named parameters to reduce bloat so that an editor of a page does not have as difficult of a time viewing it as they would with named parameters (which use up more space.) As discussed above, un-named parameters are entered in order of how they are specified in the template. For this example, we will be looking at Template:Wiki which provides an easy way to link to pages on Wikipedia (as well as visually distinguish it from other external links).
Documentation
The template page should have documentation (created using the Template:Documentation) supporting it to provide what each parameter is, what it controls, as well as when and how to use the template, as well as examples of the template. Some templates may not have documentation due to time constraints, but support with templates can always be provided by reaching out to the author of the template, User:Devonnn, or the #dgg-wiki channel in the Destiny discord.