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.

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 many wikis. (Recommended templates to copy)
 * Dev Wiki, though more suitable for Lua-based templates. A list of modules (and therefore, templates) can be seen at Global Lua Modules on Dev Wiki.
 * #|Community Central. But, it is recommended to go to Templates Wiki first, because it has improved versions of the templates in here.
 * Wikipedia or MediaWiki, though you need to read their guide on copying the templates. Credit them using wikipedia.
 * 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 Starter Pages. Although outdated, it has simpler templates.

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:模板