Help:Using templates
| Tool Box |
|---|
| Writing tips |
| Templates • Charts Categories • Footnotes Videos • Images Links Writing • Cheatsheet Discussions |
| Community • Portals |
Contents |
A template is one page on Judgepedia that can be inserted onto any number of other pages on Judgepedia. A template has two parts:
- First, "template" refers to the page where a template has been built. This page always starts with the prefix: Template: followed by the name that has been chosen by that template's creator for the template. Example: Template:Montana Supreme Court.
- Second, "template" refers to the small bit of code you can use to insert a template page into any other page on Judgepedia. That small bit of code is always the words that appear after "Template:" on the page where the template exists. To insert the template for the Montana Supreme Court onto any other page on Judgepedia, for example, you type {{Montana Supreme Court}} on the page where you want it to appear. Here's an example.
Reasons for templates
There are two main reasons that Judgepedia contributors create and use templates:
- Sometimes it is useful if the exact same information appears on a number of Judgepedia pages. When this is the case, it is better to use a template that contains that information. Why? Because then when the information changes, it only needs to be changed on one page (the basic template page) and then it automatically is changed on all the pages where the template appears. For example, this template:
| |||||||
is a list of all the judges who have ever served as the Chief Justice of the Alabama Supreme Court. The template is (or should be) inserted at the bottom of every article on Judgepedia about one of those chief justices. When that court has a new chief justice, the list will need to be changed to include the newest addition to the list of all of the court's chief justices. Because there's a template, the addition can simply be made on this page: Template:Alabama Chief Justices. As soon as someone adds the name of the new chief justice to that page and saves it, each of the pages that include that template is automatically updated.
- Templates can make it much, much easier for contributors and readers to navigate around easily on Judgepedia in certain subsections of knowledge. Some template are referred to as "navigational boxes" for that reason--because they make it so easy to browse around in Judgepedia in a clear, easy way without constantly having to use your "back" button.
Basic instructions
To include a template that already exists into an article you're working on, type the template's name in double curly brackets, sometimes also known as "braces". The braces or brackets key on your keyboard looks like: "{" or "}".
Simply type the name of the template, surrounded by two sets of braces, as in this example:
{{Alabama}}
Typing that gives you this:

For simple templates, that's all there is to it.
Finding templates
Where do you find templates that might add value to the article you're working on?
- When a template is created, it should be added to the Category:Templates. Browsing through that category may familiarize you with some templates you might not otherwise have bumped into as you get to know Judgepedia.
- Consult Portal:Templates.
Creating templates
It's very easy to build or create a new template. All you do is start a new article with the prefix, Template:. For example, if you were to add some content to this page Template:Good new things and then click "save", you would just have created a new template. The name of your new template is the words in the title of the article after the prefix; in this case, "Good new things".
For more information about how templates are created, see MediaWiki's template handbook.
Parameters
However, many templates allow you to add to the information in the template, or to change it's appearance, by supplying parameters.
For example, the Welcome template that someone might have put on your user talk page has one parameter--the name of the new user who is being welcomed.
"Pipe" characters (|) separate each parameter.
Parameters can be optional or required, and they can be named or not named. Two points need to be kept in mind with parameters:
- Named parameters can be supplied in any order.
- Un-named parameters must be supplied in the correct order.
Each template has (or will have) a list of parameters, looking something like this (this one is from the {{welcome}} template):
| Template Parameters (See using templates). | |||
|---|---|---|---|
| Name | Purpose | Required? | Comment |
| 1 | The user name | no (see note) | Defaults to the page name |
| sig | The signature of the editor posting the welcome ("~~~~" will do) | no | |
This tells us the following:
- Neither parameter is required.
- The first parameter (shown as "1") is not named (hence the number, the order in which it must be supplied).
- The second parameter is named ("sig").
- If the first parameter is not supplied, then the page name is used instead.
You can assume that if no default is shown for a parameter that is not required, the result will be blank (i.e. in this case, the welcome message would not show who it was from).
You will notice that named parameters have the parameter name followed by an equals sign (=) followed by whatever you want that to be.
Parameters shown with numbers are the un-named parameters. You can treat them as named parameters, by typing 1=your text, but this is not necessary, except in the case that you want your text to include an equals sign (=).
What do you pass to parameters?
Obviously, you give a parameter the text that it expects. But in most cases, you can give a parameter any text that you like.
In some cases, however, specific text must be supplied.
In many cases you can supply a blank value to the parameter. You can set a parameter to be blank by typing nothing after the pipe character for an unnamed parameter, or nothing after the equals sign for a named parameter.
However, a well-written template will allow you to simply omit the parameter altogether, as the {{welcome}} template does with the sig parameter.