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 "Template:Example" using the address bar of your browser, then 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.
 * 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.

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.

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 creating one from scratch. Great places to start looking for templates are established wikis about a topic closely related to your own. For instance, if you're a TV wiki, look at other TV wikis you admire, particularly those in your topic's own genre.

In most cases, you are free to copy templates based on the shared CC-BY-SA license. Giving credit to the community from which you copied the template is vital.

Templates
Here are some basic steps to copy most templates:
 * 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 on your community.
 * 4) Paste the wikitext code you copied and leave behind a edit summary which credits the wiki from which you obtained the template. Then, press the Publish button.

Template documentation
Many templates have a separate subpage for documentation about the template. If this is the case you might want to bring the documentation across as well. The process is pretty similar to copying the template itself.
 * 1) Find the template documentation you want to copy.
 * 2) Click the "Edit" button, select all the wikitext and copy it.
 * 3) Create a new template documentation subpage page on your community.
 * 4) Paste the wikitext code you copied, credit the donor wiki in an edit summary, and press the Publish button.
 * 5) Often, examples given in documentation can be specific to a particular wiki, so make sure the examples make sense for your wiki.

Further help and feedback
ar:مساعدة:قوالب ca:Ajuda:Plantilles de:Hilfe:Vorlagen es:Ayuda:Plantillas fi:Ohje:Mallineet fr:Aide:Modèles 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:模板