BattleTechWiki:Template namespace

BattleTechWiki data structure
Subject namespaces Talk namespaces
0 (Main/Article) Talk 1
2 User User talk 3
4 BattleTechWiki BattleTechWiki talk 5
6 File File talk 7
8 MediaWiki MediaWiki talk 9
10 Template Template talk 11
12 Help Help talk 13
14 Category Category talk 15
100 Policy Policy Talk 101
102 Property Property talk 103
106 Form Form talk 107
108 Concept Concept talk 109
112 smw/schema smw/schema talk 113
114 Rule Rule talk 115
118 Draft Draft Talk 119
828 Module Module talk 829
3000 Portal Portal Talk 3001
3010 Guideline Guideline Talk 3011
3012 Information Information Talk 3013
Virtual namespaces
-1 Special
-2 Media
Current list (API call)

The Template namespace on BattleTechWiki 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 BattleTechWiki 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).

A template is transcluded into another page by including a template tag in that page's content. A template tag contains the template page name surrounded by double curly braces, e.g. {{Disambiguation}}. If the template's page name does not begin with a namespace and colon, it is assumed to be in the Template namespace.

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.


  • Templates should not normally be used to store article text, as this makes it more difficult to edit the content. They should also not be used to "collapse" or "hide" content from the reader.
  • Templates used in articles are designed to provide information to assist readers, such as navigation aids, formatting, or warnings that content is sub-standard. Templates that provide information only of service to editors should not appear on article pages – use the article's talk page or other non-article namespaces.
  • Template function should be clear from the template name, but redirects can be created to assist everyday use of very popular templates.
  • Templates should be clearly documented as to their usage and scope.
  • Templates for short, temporary messages that will be removed quickly (such as on User_talk: pages) or that contain text which is not likely to ever be changed should be invoked with substitution (subst:). Typical templates that are intended for long-term use and are likely to require changes should be transcluded for easy future updates.

Suggested practices[edit]

Referencing templates[edit]

Sometimes you will want to refer to a template, rather than actually invoking it. An easy way to do this is to call Template:Tl (short for "template link"). For example, to reference the Cleanup template, typing {{tl|Cleanup}} results in {{Cleanup}}. You can also add parameters using Template:Tlp; for example, {{tlp|Convert|1|m}} displays as {{Convert|1|m}}.

Check the template documentation on Template:Tl for other options, such as {{tlb}} (bold), {{tlx}} (code), {{tlxi|param1|param2}} (italic parameters), and many more.

Template names[edit]

Template names can be made of one or more words, such as {{Train topics}}. The first character (only) is not case-sensitive, so {{cleanup}} and {{Cleanup}} are the same template, but {{cfd}} and {{cfD}} are not. Template names are easiest to remember if they follow standard English spelling, spacing, and capitalization (also see the naming conventions for articles). Avoid having templates whose names differ only in case, spacing, or punctuation.


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 helps future editors to more easily read the wikicode.

{{Example template name
| first_parameter  = Text of first_value
| second_parameter = Text of second_value
| third_parameter  = Text of third_parameter
| etc              = etc

Line breaks[edit]

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 BattleTechWiki: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.


Invoking a template using the form

{{subst:name of template (|parameters |...)}}

(that is, inserting subst: immediately after the opening pair of curly brackets) will make a copy of the template text and place it on the page, where it will be viewable in the source. The template is no longer transcluded and future changes to the template will not change the text. As a guideline, this method should be used for any short, temporary messages which are removed quickly, such as on User_talk: pages. The standard new user {{Welcome}} message is a good example.

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:

'''This is a {{{1}}} article.'''<noinclude>
Place this template on any article that requires description. It 
takes one parameter, an adjective used to describe the article. 
For example, {{article-describe|bad}} produces the text, 
'''This is a bad article.'''

Another alternative is to create a formal /doc subpage for the documentation (preferred for templates with multiple parameters, etc.) and add <noinclude>{{Documentation}}</noinclude> after the actual template. The first "noinclude" tag should be placed on the same line as the end braces of the actual template in the following manner:

{{(template name)
(piped parameters)

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.


Lua modules are sometimes used instead of templates to store reusable material. Reasons for this include usage of module-specific features such as loops or stored values, and complex code is often easier to read and maintain in a module. If a module is easily implementable in a template it generally should be, since there are more users with experience editing templates.

If a module is intended to be used in articles or talk pages, a template wrapper should generally be created to simplify usage without directly requiring the #invoke parser function. Documentation is then mostly located on the template's /doc page, with the module's documentation pointing to the template and/or explaining further technical details that are unnecessary at the primary template documentation.

There are sometimes reasons not to use a template wrapper, however, such as causing potential issues with template limits; a template wrapper that passes too many parameters to a module is much less efficient compared to a direct invocation. Additionally, it is generally not desirable to use template wrappers in other templates.

Searching for templates[edit]

Pages which contain information on commonly used templates:

See also[edit]


  1. Namespaces from which transclusion is not allowed are specified on a wiki by the variable $wgNonincludableNamespaces