Wikipedia:Template namespace

The Template namespace on Wikipedia is used to store templates, which contain Wiki markup intended for inclusion on multiple pages, usually via transclusion. Although the Template namespace is used for storing most templates, it is possible to transclude and substitute from other namespaces,[1] and so some template pages are placed in other namespaces, such as the User namespace.

Templates help maintain consistent formatting and aid navigation between articles. They often include optional and/or variable elements controlled by parameters to allow for specialized use. Templates are also used to assist in a large variety of Wikipedia maintenance tasks. Each template has a matching Template talk: page where editors can discuss the design and implementation of the associated template (see Help:Using talk pages for how to participate in talk page discussions).

Internal links to template pages may be made by using the Template: prefix, e.g. [[Template:Disambiguation]]. These links go to a page that directly contains a base template and often documentation.

For templates that use a large number of parameters, it can be helpful to place each parameter on a separate line and align the equals signs. This help future editors to more easily read the wikicode.

Some templates may accidentally cause extra line breaks in the rendered articles. This is especially true of infobox templates and other template boxes that usually float on the right side of an article, since the additional lines will not be seen on the template page. For more information, see Wikipedia:Line-break handling.

As a general guideline, avoid two line breaks together in your template. These may "add up" with other line breaks in the article and be displayed as unwanted white space.

Use subst: also if you need to edit the message after including it on the page. If you don't need to edit it, and would rather the message is automatically updated along with changes made to the template, don't use subst:.

Because templates represent a step up in difficulty for the novice editor, documentation should be provided which describes its usage (optional parameters) and scope (where it should be used). There are two different ways to do this:

One alternative is to use <noinclude> to add a minor description direct into the template, for example:

If the "noinclude" tag starts on the line below the template's closing braces, then unwanted whitespace is introduced at the bottom of the template when it is used in articles and on other pages.

For a short time, Wikipedia:Articles for deletion (then known as votes for deletion or VfD) used MediaWiki: messages named in the format "MediaWiki:VfD-articlename". These were moved to the Template: space in June 2004 and were named "Template:VfD-articlename". This usage is deprecated now in favor of subpages.

Around 2005, growing complexity of template functions and the desire to consolidate similar templates led to the creation of extremely complex conditional hacks such as nested templates and CSS tricks. These undesirable methods led to the development of m:Extension:ParserFunctions, added in 2006 with MediaWiki 1.7. By 2009, many problems with template readability and complexity still remained (). In 2013, in order to address page load times, mostly due to slow template renders, Lua was enabled, creating a Module: namespace for programmers to make use of ().

Use this form to search in the Template: or Template_talk: namespaces. See Help:Searching for more information.

If you're unable to find an existing template for your situation, but don't feel comfortable creating one yourself, you can ask for help at Wikipedia:Requested templates.