A template is a page, like its title says, a page which can be included into any other page, and sometimes be customized. This page gives tips on creating and using templates.
Templates in most cases, are very easy to create. They should have the prefix Template: (see Help:Namespaces), but it doesn't need to be included to other pages.
This template below is an example. It can be included in the current page by typing {{example}}. "Example" is the name of the template, and the two curly braces are used to include it:
Correct
The template was successfully included in this page.
Sometimes, you may want to write about the template on its page (often to explain how and when to use it), but you don't want this text to appear on the template itself. To do this, you should enclose such text with <noinclude> and </noinclude> so that it does not appear on every page you use the template on. An example can be found in the {{policy}} template. Below the box is a line of text that does not appear on policy pages. The opposite can also be made, by writing <noinclude> and </noinclude> tags around to only make text appear when included. This is very useful for categories.
Templates can be substituted by writing {{SUBST:Template name}}, {{SUBST:Namespace:Page name}} or {{SUBST::Page name}}. By writing {{SUBST:Example}}, the content on {{Example}} is placed on the page instead of just {{Example}} when someone edits.
This Super Smash Bros. related article or section is a stub. You can help SmashWiki by expanding it.
A template is a special type of page that has been designed so its content can be included in other pages. Since a given template can be included in many pages, it can help reduce duplication and promote a uniform style between pages.
Templates are usually located in the Template namespace. This includes any page with a name beginning with Template:, such as Template:Name.
Video overview
If you're new to templates, this video will help you get started.
Creating content that should appear on many pages.
Formatting content (such as infoboxes) in a way that should be consistent across many pages.
Creating a shortcut for writing things that you repeat often when communicating with others.
Replacing long, complicated code so that a page is easier for other users to edit.
Protecting parts of a page from editing while leaving other sections open for edits.
How to create a basic template
Templates can be very powerful, but also sometimes very complicated. It often helps to start by creating the simplest possible kind of template, and then experimenting from there.
Click "Publish." You have just created a template with some sample content.
On your wiki, create a new article called "Testing templates".
In the editor, go to Source mode and enter the following code:
{{Example}}
Click Publish. Your "Testing Templates" page should display the text you added to your template.
You've successfully created and used a template! Now you can change the content of your template and add it to more pages to make it more useful for your wiki.
Adding and editing pre-existing templates
Wikis come with pre-loaded default templates. You can view a complete list of templates available on your wiki by going to Special:AllPages and selecting "Template" from the namespace dropdown menu. Click "Go" and all available templates will appear in a list.
In the Visual editing mode, you can select from the list of all templates available on your wiki by clicking "Add other templates".
In source mode, you can use the code {{Template name}} to add any template to your wiki.
Advanced users can edit the page MediaWiki:Editor-template-list to change the list of templates available by default in the "Templates" section of the editor. Up to 4 templates can be in this list.
Substituting templates
A different way to use a template is to substitute its content into a page. This is done by inserting subst: immediately after the opening braces: {{subst:templatename}}. Once the page is saved, the link to the template is removed and the template output is substituted in its place and can be further edited. Any updates to the template will not affect the content that was substituted into the page.
Wikia's official Starter Pages and semi-official Templates wikis occasionally improve some of their documentation as well as adding new templates specifically designed for Wikia sites, and are therefore worth checking from time to time.
For sites created before about December 2008, the Starter Pages wiki should be compared and ideally used for upgrading to its standard documentation system similar to that introduced in Wikipedia.
Template Webinar
Looking for further video instruction? This webinar recording overviews the basics of adding and customizing templates for your wiki.