Using Templates

From Frustule

Jump to: navigation, search

Contents

Overview

Templates are user-created page structures that are designed to make creating new articles simple and consistent. In this wiki, templates typically are used for terminology and taxonomic articles, but they can be designed or used for any purpose. Templates should be created with the specific purpose of making life easier for other wiki users - keep the variable names obvious and the design consistent with the rest of the wiki.

How to Create a New Article with a Pre-existing Template

The simplest way to add a new article with an existing template is to find a page that utilizes the template, click the edit button, and copy all of the text. Then create a new page and simply paste the whole template in and replace the variables used with the information for the new article.

Template Components

To highlight the features of a template, we will create an example using the terminology template. The template itself has more coding than we need to know to simply use it, so for now you can ignore the template page itself and let's focus on an example term. Here is code similar to what you see when you click the edit tab on the term areola:

{{ Terminology
| Term=Areola, Areolae
| Definition=Regular perforations in the valve wall, typically covered by a [[velum]], often marked by more or less elaborate multi-angular walls or ribs.
| References=
* {{Hasle & Syvertsen (1996)}}
| ExtLinks=
| ImaGall=<gallery widths="150px" heights="150px" perrow="2">
Image:Cyc1.png|Areolae
</gallery>
}}

The Template

The template is essentially a structured filter that you pass information through and then let it format for you. It has a number of components - the first component being the template used, which in this case is:
{{ Terminology }}

This tells the article you are editing which page to pass the information to. The terminology template is on a page named "Template:Terminology".

Variables

This page has a series of variables that have been formatted by some user. In this case, the variables are: Term, Definition, References, ExtLinks, and ImaGall. Each of these are prefaced by a pipe "|" and followed by an equal sign "=". Whatever you put after each equal sign is what will get passed through to the template and fed back in a formatted version to the article you are editing.

| Term=Areola, Areolae

To edit this variable to a new term, you would simply replace the text "Areola, Areolae" with your own (in this case, fake) term, as follows:

| Term=Jabberwocka, Jabberwockae

You can fill in the definition, any references, and any external links used in the same fashion.

Some variables have been coded so that they will only appear if a value has been placed after the equal sign. If a page is created without the variable being listed in the template brackets, the variable will show up on the page with brackets around it. It's preferable to list the variable to remove this, even if the article has no value for it.

Multiple Definitions

If you wish to have multiple definitions split into a numbered list, you can do this by using the following code:

| Definition=<br>
# Definition 1 goes here
# Definition 2 goes here

The "br" tag is to make the following line start with a pound sign (#) which is wiki markup code for create a number list. Each new definition should start a new line with a pound sign and you can add as many definitions as you like.

Passing a Gallery as a Variable

The terminology template (and many others) have a variable for images. To keep them organized, these images should use the gallery tags.
<gallery></gallery>
Gallery tags will make images in a list into a gallery of thumbnail images with captions.
| ImaGall=
<gallery widths="150px" heights="150px" perrow="2">
Image:Cyc1.png|Areolae
</gallery>

You can add as many images as you like to the gallery, simply by listing the wiki image article (in this case the image is Image:Cyc1.png) - each on a separate line. The pipe character separates the image name from the caption. The gallery thumbnails can be adjusted by changing the widths and heights values in the gallery tag and the number of rows can be changed by changing the value 'perrow'.

Articles with both Template and Non-template Components

Some of the templates are designed to automatically categorize any articles that use them. For example, all articles that use the Template:Terminology are automatically categorized as Terminology. Most terms also have addition categories (and if you are adding a new terminology article, you should continue this practice) which are included after the template tag (}}) is closed. For more information, see this wiki tutorial on using categories.

Some articles also have both template and non-template information, such as species or genus description articles. This is to allow greater flexibility for the articles. Information that appears after the template tag has been closed will appear on the article below the template. By convention, the existing templates should always go at the top of any article and additional non-template information follows.

Personal tools