Community Central
Community Central

Have you ever seen the word 'Template' but never understood what it meant? Or someone told you 'create a template page' and you had no clue? This guide is for you to figure things out! Lucy is on the line, buckle up.

What are templates?

Templates are a special way to store data on your wiki. It is a way to tell Fandom 'hey, can you please keep all this huge scary code for me here, and I will decide what to do with it later?' You create a big and spooky layout once, and next time you need it, you won't have to write it all over again, Fandom will remember it for you.

How do I create a template page?

A template page is created the same way as any other page on your wiki. You can press 'Add new page' on the drop-down menu on top, or you can type the name in the URL, then see the warning that the page doesn't exist and press 'Create this page'. The only difference between an article and a template would be the page name: it must start with Template: and then the template name. An example would be Template:InfoboxCharacter. You can choose ANY name for your template, however, it should be easily understandable for other people willing to contribute to your wiki.

What do I write on this page?

The template page is a code storage, so let's try to create a simple table with placeholders for a start. First, we create a page called Template:Test. Please, get used to the source editor instead of the visual one because templates cannot be edited in the visual mode.

Now let's create a simple table. Fandom uses MediaWiki markup which makes our life a little easier, and our code a little smaller. The {| |} are used to start and finish our table, they are our way to tell Fandom 'Please, start the table here and finish it here'. For the contents of the table we will be using | and |-. The first one creates a cell, the second one moves us to the next row below. If we wish to have the default Fandom table styling, we would need to use a pre-made class for it (classes also serve as code storages but you can't see them that easily). For example, class="wikitable" is one the pre-made classes on Fandom that lets you use the table styling without writing any extra code.

{| class="wikitable"
|Cell 1
|Cell 2
|-
|Cell 3
|Cell 4
|}
Cell 1 Cell 2
Cell 3 Cell 4

Now let's imagine the following situation: you have 10 pages that need this table, and each page needs different contents for each cell. How to replace them? Create 10 separate template pages? Hell no! We need to fill in our cells with placeholders. Placeholders do exactly as the name suggests: they stick around, have fun partying and drinking, and as soon as you need some specific content to fill in the spot, they are happy to let it in. Placeholders on Fandom are usually created with {{{ |}}}.

Let's replace the text inside the cells with placeholders. Instead of typing 'Cell 1', we need to type {{{cell1|}}}. Here is how our code will transform:

{| class="wikitable"
|{{{cell1|}}}
|{{{cell2|}}}
|-
|{{{cell3|}}}
|{{{cell4|}}}
|}
{{{cell1|}}} {{{cell2|}}}
{{{cell3|}}} {{{cell4|}}}


Congratulations! Our simple template page is ready! Now what?

How to call a template?

Now we go to an article page (the character main article or the game description or anything you need) and open source mode. {{ }} are used to tell Fandom 'yo, here goes my template'. After the first {{ you need to type your template page name. Ours was called Template:Test so we will type {{Test on the article page now. After that on the next line we need to tell our placeholders to stop chilling out there and let our content in. For example, I want my first cell to display 'Hello', my second cell will say 'Guten Tag', my third one will say 'Привет', and my fourth one will be 'Buongiorno'. I need to start each new line with |, then the placeholder name, then = and then my text. That is exactly what I am typing:

{{Test
|cell1=Hello
|cell2=Guten Tag
|cell3=Привет
|cell4=Buongiorno
}}
Hello Guten Tag
Привет Buongiorno

It's done! We have created our template, filled it in with placeholders, then called it on the page and told Fandom what content we want displayed. PAY ATTENTION: the code that goes BEFORE = must match the placeholders names inside the template. Everything that goes AFTER = can be changed freely.