A template is a page that can be inserted into another page. Templates provide a convenient mechanism for setting up boilerplate content on your wiki. This tutorial focuses on how to create a template that can be adjusted later on so that existing pages reflect the changes:
1. Select Tools->Templates.
2. Click the New Page button to open a new template in the editor.
3. Enter the template name and content. The following example creates a template titled "FAQ Entry". It expects two parameters "question" and "answer" and accesses their values using {{ $question }} and {{ $answer }}:
4. To use the template, open the destination page and enter:
{{ wiki.template( "<name>", {<arg1>: <value1>, <arg2>: value2, ... }) }}
Where <name> is the name of the template, <arg1> is the name of the first parameter, <value1> is the value of the first parameter, and so on. For example, the following page includes the "FAQ Entry" template with the "question" and "answer" parameters:
| |
If the appearance of the "FAQ Entry" template changes, it will automatically be reflected on this page.