Zelda Wiki:Making Templates

From Zelda Wiki, the Zelda encyclopedia
Jump to navigation Jump to search
Zwlogo2dlarge.png
Zelda Wiki's
Help Guide
Basic Editing:

Getting Started
Citing Sources
Images and Uploading
Initialisms
Protected Pages
Redirects
Talk Pages
Templates (Template List)

Guidelines and Policies:

Canon Policy
Editing Etiquette
Image Deletion Policy
Inter-Wiki Policy
Nintendo Article Guidelines
Quality Standards
User Accounts
User Conduct

Advanced Editing:

Archiving Talk Pages
Article Reorganization
Custom Signatures
Keyboard Shortcuts
Merging and Moving Pages
Patrolling
Tables
User Navigation Bars
WikiExclusives

General Information

Staff
User Rights
About
Glossary


Templates are essentially subroutines for wiki content. In fact, making them anything but the simplest of templates requires a bit of programming skill.

Creating a Template

The easiest way is to type {{your template name}} to the Sandbox, and click on the red link that appears after saving or previewing. At the resulting editing page, you can create your template, which is most easily done by copying and pasting the code from a similar template; then you can just modify it.

Make sure that directly after the end of your template text (not even leaving a space nor new line!) you add <noinclude> to begin any section detailing how to use the template, and also the add the necessary category for that template, and at the very end type </noinclude> to enclose the section and category. Do not finish the template, create a new line, and then add the <noinclude> tag.

Parameters



Parser functions



Cargo



Lua



Testing a Template

When editing a template, a "preview page with this template" option will appear at the bottom of the edit form. In the "page title" box, enter the name of a page that currently uses the template and pressing the adjacent "show preview" button. This allows you to preview the template as it would appear on that page if you had saved the edit.

The template sandbox Template:Test (in the list of sandboxes at Zelda Wiki:Sandbox) can be used to test your templates.

Sandboxed templates can also be tested on pages using Special:TemplateSandbox. Please refer to MediaWiki for more information on this feature.

Alternatively, since one can transclude not only Templates but ordinary pages (e.g. {{:Bombchu}} will display the entire bombchu article content), then for example you can create your own template sandbox on http://zeldawiki.org/User:<my username>/Sandbox/Template:Testing, and type {{:User:<my username>/Sandbox/Template:Testing}} into a sandbox to use it.

In addition, after making a template, you can view it or troubleshoot issues with Special:ExpandTemplates, which will expand all templates recursively, i.e. repeatedly substituting all templates (and templates in templates) until no {{ ... }} remain.