Help/Making Templates

If you've read the articles on the page, regarding Wiki code, you know how to add templates to a page. You might ask, however; how would one create such a template in the first place?

We have tried to accomplish two things with templates this year. First and foremost, we've tried to make them more portable. Portability means that you can read content easily on any device, whether it's desktop, mobile web, mobile apps, or other second screen experiences. Tools to help with this include Portable Infoboxes and Flags. We've also been trying to make sure admins have more tools to understand and organize their templates better, through better editing interfaces and some of the information presented on the Insights platform.

Wikia isn't done moving forward with templates yet and we anticipate this work will continue well into the coming year. But in planning our next steps for improvement, we face a unique problem.

As I mentioned, templates come in many, many varieties. The sheer volume of options means that it's hard to easily, quickly, and accurately know - whether you're a human reading the code or a program analyzing the wikitext - what the exact purpose and design of a template is.

To help tackle this issue for our engineers and our community alike, we've been ramping up a project called **Template Types**. Its goal is simple: assign a type to every template on every community. Essentially, it involves giving each template a classification such as 'infobox', 'navbox' or 'quote'.

## Advantages of Types

With all templates classified we can start to offer some interesting benefits for both our users and for our portability initiatives.

With more consistent types, we will be able to deliver better editing experiences for different styles of templates, such as smarter syntax highlighting depending on the markup you'll likely use, template prefills when creating a new template from scratch, and even better ways to browse and import the most popular templates across the Wikia network.

This will hopefully also lead to more powerful article editing as well, such as suggesting templates to insert based on categories and similar templates used; a better, more template-specific "insert" flow for VisualEditor; and preventing certain templates from being inserted onto certain namespaces.

In the portability realm, a better understanding of what general purpose or type each template is will allow us to build classification-specific displays for our multi-device world. Take pull quotes for example. Right now, there is no way for our mobile skin to explicitly know that a template given is meant to be pulled out of the page and displayed prominently. With our minimal CSS approach to mobile, a pull quote template is likely to display text inline at normal size. If we can be made aware that a transcluded template is indeed a quote, we can display it differently than an infobox.

One feature, available today, is **Special:Templates**. This new tool will list all templates on your community and will let you quickly search and filter to find the exact template you’re looking for.

Types will be a new piece of data, not a MediaWiki category. This project will not change the wikitext of a single template or article page by even a single byte. This relies on storing the data under-the-hood and won't get in your way.

To classify a template, you will see the feature under the article name on the template page and in the right rail of the editor when you're editing a template. Clicking the pencil icon will open the tool to select from the list of options. We'll also show the feature when you create a new template.

Some of the current types are:

* *Infobox* — Displays the most essential snippets of information about an article in a box, most commonly at the top right of an article page.
* *Navbox* — Provides a list of organised links for readers to navigate to similar articles, most commonly at the bottom of an article page.
* *Quote* — Highlights notable snippets of text, such as lyrics, book passages, or quotes.
* *Citation or reference* — Organizes and standardises the display how sources of content on an article page are annotated.

## Basics

All templates are made in Source mode. If you haven't read the article on Wiki coding, read it before attempting to make any template. Otherwise:

* Go to "Add a page".
* Click "Blank page".
* Under the name of the page, type "Template:[Template Name]" (fill in whatever name you would like). This step is **important**! If you don't use a template prefix, you will not end up with a template.
* After clicking on "create" you should see a blank page. Start coding from here.

## Two kinds of templates

On the wiki, most templates fall into one of two categories; infobox or navbox. Navbox templates are found at the bottom of most of the wiki's pages, and help users navigate between common pages. Infobox templates are the templates that you'll see on the top right corner of many pages; they display much of the information about the thing that the page is talking about in a nutshell. For example, the NPC infobox tells you things such as spawn locations, faction, alignment needed to hire, when the NPC was added, and much, much more.

## How to make a Navbox

To make a navbox template, I recommend that you start from a pre-existing navbox, for example the `{{Drinks}}` template.It will contain much of the code that you need for making your new navbox. All you need to do is add the correct number of sections and dividers and change the links as required to make the template into what you need.

### Guidelines

The following standards must be adhered to when making navboxes:﻿

* They must contain bullets (•) between links and not vertical lines. An easy way to do this is to insert the `{{*}}` template betwen links.
* They should be collapsible. To do this add the `class="mw-customtoggle-XXXX"` tag to the `<div>` tag in the top of the navbox, and put all your links between the `<div class="mw-collapsible mw-collapsed" id="mw-customcollapsible-XXXX">` and the final `</div>` tag. Replace the "XXXX" with an appropriate ID for the template.
* Most navboxes add pages to categories. Use the `<includeonly>` tag, and put the name of your category page inside the tags, as in the usual fashion.

## How to make an Infobox

To make infoboxes, it's advisable to start from a preexisting infobox, and then modify it as needed:

`|-
! colspan="2" | <div class="wikia-infobox-section-header">Section Divider</div>`

makes bold dividers between sections, and

`|-
! Heading Title

puts blank boxes into the template behind which you can write information.

Template:Help