Help:Templates

Templates are pages designed to be included on other pages. They are found in the Template namespace and usually display material that needs to be shown on multiple pages at the same time. Templates are vital tools for wikis to run efficiently.

There are many different types of templates that fulfill different purposes. Templates like infoboxes or citations promote a uniform style on the wiki, while others are used in tandem to structure a single page such as the main page.

Template pages are created and modified using the source editor. Most templates can be added, or transcluded, on pages while using any editor interface, but complicated templates may be easier to work with in the source editor. Editing a transcluded template will update how it appears on all of the pages where the template is transcluded.

Finding and using templates
New Fandom communities have a set of ready-to-use default templates. You can view a complete list of templates on any community by going to Special:AllPages and selecting "Template" from the namespace dropdown menu.

Once you've figured out what templates you have to work with, you can begin thinking about how to use them in their most basic form. The instructions are slightly different depending on the editor interface:


 * In the VisualEditor, click on the bolded word INSERT found in the top middle of the page and click "Templates" from the dropdown list. You can also type  in the page itself. In the dialog box that appears, search for the name of the template you wish to include.
 * In the source editor, simply type  replacing TemplateName with the name of the template.

Creating a basic template
Templates can be powerful, but some templates can be complicated. It often helps to start by creating the simplest possible kind of template.
 * On your community, navigate to  using the address bar of your browser. On Community Central, this would be  https://community.fandom.com/wiki/Template:Example
 * Click the "Create Source" button in the top-right corner of the page. This will open the source editor.
 * A popup will appear, asking you to choose a template type. Select the option that matches the template you want to make, or select "Unknown" if you're not sure, then click the "Save" button at the top-right.
 * Type a few words or a sentence in the editor. Example:
 * Click "Save" at the bottom right. You've just created a template!
 * Go to your user profile or another testing page on your community.
 * Follow the steps above to insert the template depending on your preferred editor.

The page that you created should show:
 * This is example template text. For demo purposes only.

Congratulations! 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.

For a full guide on creating and using templates, visit Help:Templates on MediaWiki to learn more.

Template parameters
Many templates also feature parameters. Think of these like variables. Different pages can use the same template with different values for each parameter. Depending on the template, this can alter the template's text or the way the template is designed.

Let's take Template:Wikipedia as an example. This template is designed for pages that use content from a Wikipedia page; it creates a box with a link to the Wikipedia page. Adding just  assumes that the page on Wikipedia has the exact same name as the page the template is being used on. However, if the two page names are different, we can use a parameter to alter the link. Adding  ensures that the link will point to Wikipedia's "Microsoft" page. VisualEditor provides options for setting parameter values when adding a template or clicking on it in the editor.

To learn more, see Help:Template parameters.

Substituting templates
Adding a template to a page through VisualEditor or by typing  will always show the most recent revision of the template on that page. This process is called transclusion.

A different way to use a template is to substitute its content into the page. Template substitution can only be done in source editor by changing the code to. Once the page is saved, the link to the template is replaced by the template's output.

Editing the template will not update the content that was substituted into the page. Think of substitution like a cookie-cutter: if you use a cookie cutter to make a few cookies and then change the shape of the cookie cutter, the cookies you already made will not change their shape.

To learn more, see Help:Substituting templates.

Documentation
Suppose you want to use a template. You try to use a standardized template, like Notice. However, you don't know how to use the template and you don't want to look at the template code.

This is where documentation comes in. Many complex templates often have a documentation section, added using documentation. The documentation of a template is useful to provide instructions on how to use the template, its parameters, and also examples of a template. It can also have mw:Help:TemplateData to aid you when using VisualEditor.

You can easily add documentation on templates that don't have one, if you know how the template it used.

To learn more, visit Help:Template documentation.

Lua-based templates
Most basic templates are designed using wikitext, the same code used on pages. However, advanced wikitext templates can appear too complicated to read and slow down the pages they're used on. In these cases, Lua is an alternative option. While coding in Lua can appear daunting at first, Lua-based templates perform faster than their wikitext counterparts and can be easier to read and understand. The Fandom Developers Wiki maintains a list of Global Lua Modules designed to replace or enhance common wikitext templates; some of these global modules are available on new communities as well.

To learn more, see Help:Lua.

Copying and updating templates
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 create one from scratch. In most cases, you are free to copy templates from other Fandom wikis based on the shared CC-BY-SA license. Giving credit to the community from which you copied the template is vital.

It is recommended to export and import templates, as it keeps the edit history which is vital by CC-BY-SA license required by FANDOM. (Although it requires adminsitrator permissions.)

If you can't import pages, an alternative is to copy the template. Here are some basic steps to copy most templates: More information can be found at this page on Templates Wiki.
 * 1) Find the template you want to copy.
 * 2) Click the Edit button, select all of the wikitext, and copy it.
 * 3) Create a new template page in your community.
 * 4) Paste the wikitext code you copied, add an edit summary which credits the wiki from which you obtained the template, then click the "Save" button.

Where to find more templates

 * Templates Wiki has many useful templates designed for use in other wikis. (Recommended templates to copy)
 * Dev Wiki holds a repository of Global Lua Modules which can be used from any Fandom wiki. See the documentation of each module about how to create the appropriate template on your wiki and link it to the Lua code. Some CSS or JavaScript enhancments on Dev Wiki also have related templates.
 * #|Community Central has a lot of templates, though most of them aren't suitable for other wikis. Some of them serve as global templates and can be used on any wiki without copying - see Help:Shared templates.
 * Wikipedia or in MediaWiki.org, though you need to read their guide on copying the templates. Credit them by using wikipedia or by specifying the approriate origin.
 * Other wikis related to your topic. For instance, if you're on a TV wiki, look at other TV wikis you admire, particularly those in your topic's own genre.
 * Fandom UCP Starter Pages. This is where the initial main page and templates come from when creating a new wiki today. Sometimes the templates there can help older wikis or serve as a basis for developing a template.

Further help and feedback
ar:مساعدة:قوالب ca:Ajuda:Plantilles de:Hilfe:Vorlagen es:Ayuda:Plantillas fi:Ohje:Mallineet fr:Aide:Modèles id:Bantuan:Templat it:Aiuto:Template ja:ヘルプ:テンプレート ko:도움말:틀 nl:Help:Sjablonen pl:Pomoc:Szablony pt:Ajuda:Predefinições ru:Справка:Шаблоны tr:Yardım:Şablonlar uk:Довідка:Шаблони vi:Trợ giúp:Bản mẫu zh:Help:模板