Zelda Wiki:Making Templates

From Zelda Wiki, the Zelda encyclopedia
Jump to: navigation, search
ZW Logo White.png
Getting Involved Getting Involved.png
Getting Involved
[1] Discord Logo.svg
Knight Challenges Knight Challenges Icon.png
Knight Challenges
Image edit request and support center Gimp Logo.svg
Image Requests
[2] Trello Logo.png
Guidelines:Main Guidelines Icon.png

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.


Parser functions



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.