Help:Templates

Templates are special types of pages that can be put into other pages with extra parameters to modify them.

Types of templates

 * Navigation templates are used to navigate between related pages, and are usually navboxes.
 * Formatting templates are used to simplify hard-to remember formatting, usually HTML attributes.
 * Box templates are templates that use the Box template as a base.
 * General wiki templates are templates used for various purposes, such as being used in other templates.
 * Infobox templates are used to make infoboxes.

Basic templates
The most basic of templates are templates with no parameters, such as Welcome, which you can add to pages simply by putting the template name inside two curly brackets ({ and }) much like a link.

Templates with parameters
Templates with parameters are templates that can be modified to suit the page they are on. Parameters can be either numbers or words. On the template code, they are represented by putting the parameter name in three curly brackets. To use numbered parameters, simply put a pipe (|) after the template name within the brackets, and repeat for each number. To use word parameters, put  after the pipe and before the parameter content (it is also possible, but not required, to do this with numbers). Most templates have a section at the bottom explaining the purpose of each parameter.

Default parameter values
Parameters can be set to have default values by putting a pipe after the parameter name but before the three ending curly brackets and then the default value, similarly to calling a numbered parameter. You can also put nothing after the pipe to make the parameter not appear unless filled out (useful for if statements).

noinclude and includeonly
In order to avoid a mess of categorization and repeating template documentation every time they are called, noinclude and includeonly are used. should be put immediately after the part to be included in the page (transcluded) ends. Text that should not show up on the template itself, but should show up on the page it is included on (usually categories), wrap it in.

Adding content only if a parameter is filled
It is possible to only have content be filled out if a parameter is filled out. To do this, use. For more information on #if and similar functions (such as #ifeq), see the mediawiki extension page for it.

Using non-templates as templates
Pages besides templates can be used as templates by linking to them normally, except replacing the brackets with curly brackets. For mainspace pages, you will need to put a colon before the title. This is usually only used for testing templates in a sandbox.