Help:Templates

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 can be useful for...
 * 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 to a frequently-visited page or 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.

Templates are usually located in the [     namespace]. This includes any page with a name beginning with, such as. A list of used templates can be seen in Special:Templates and can be filtered by template types.

Note: Templates cannot be edited by anonymous users.

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.
 * On your community, navigate to "Template:Example" using the address bar of your browser and click "Create".
 * You should see a popup asking you to Choose template type; check one of the options.
 * Type "Hello, World" in the editor.
 * Click "Publish". You have just created a template with some sample content.
 * On your community, create a new article called "Template test".
 * In the editor, go to source mode and enter the following code:


 * 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 community.

Adding pre-existing templates
New FANDOM communities come with pre-loaded default templates. You can view a complete list of templates available on your community 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 editor's visual mode, you can select from the list of all templates available on your community by clicking "Add other templates".
 * In source mode, you can use the code  to add any template to your page.
 * Advanced users can edit the page MediaWiki:Editor-template-list to directly show up to four common templates in this section. The wikitext should be written like this, one per line:

Template parameters
Templates can have parameters. These allow you to alter the way the template is displayed, such as including specific text or altering the design.

To take Template:Wikipedia as an example, adding just  assumes that the page on Wikipedia is the same name as the page of the current page the template is used on. However, a parameter can be added, e.g., to tell the template that the page on Wikipedia was Microsoft.

To learn more about how to change the output of the template based on what the user inputs, see Help:Template parameters and Help:Parser functions.

Substituting templates
A different way to use a template is to substitute its content into a page. This is done by inserting  immediately after the opening braces:. 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.

To learn more, visit Help:Substituting templates.

Updating and adding standard templates
The official Starter Wiki and semi-official Templates Wiki occasionally improve some of their documentation as well as adding new templates specifically designed for FANDOM sites, and are therefore worth checking from time to time.

Copying templates from other wikis
Contributors throughout FANDOM have made all different kinds of templates. It is often simpler to copy an existing template and modify it for your needs, rather than creating one from scratch. The Templates Wiki is a good place to start looking for a template that fits your needs. In most cases, you are free to copy templates based on the shared CC-BY-SA license, but make sure the community you want to copy from does not have an alternative licensing scheme that may place restrictions on what you can copy. Giving credit to the community which you copied the template from is recommended and would likely be appreciated by that community.

Here are some basic steps to copy most templates: Many templates have a separate subpage for documentation about the template. Fortunately, the location is often standardized, so it is easy to copy the documentation as well. If you notice the template page you copied above does not look like the original, it is likely the documentation is on a separate subpage:
 * 1) Find the template you want to copy (usually http://wikiname.wikia.com/wiki/Template:templatename).
 * 2) Click the Edit button, select all of the wikitext and copy it.
 * 3) Create a new template page on your community (http://yourwiki.wikia.com/wiki/Template:templatename?action=edit).
 * 4) Paste the wikitext code you copied and press the Publish button.
 * 1) Find the template documentation you want to copy (usually http://wikiname.wikia.com/wiki/Template:templatename/doc).
 * 2) Click the Edit button, select all the wikitext and copy it.
 * 3) Create a new template documentation subpage page on your community (http://</tt>yourwiki.wikia.com/wiki/Template:</tt>templatename/doc?action=edit</tt>).
 * 4) Paste the wikitext code you copied and press the Publish button.

Previewing edited template
It is desirable to preview any template you have edited. Normally you can then click "Publish" from the preview screen. However, if nothing then seems to happen, the template probably has no data type yet, so click "Back" and check.