RuneScape:Template policy

Templates are very often used on the RuneScape Wiki, and they can be anything from static wikicode, shown on a page whenever it's placed on it, to extremely complex calculations and dynamic tables.

When you create a template, you may have it use parameters to insert some text defined by the editor who uses your template, or have it use magic words so it acts differently according to the page it's used on. If your template uses parameters or magic words – anything beyond just displaying text –, you need to document it.

Basic templates don't need documentation
If, when an editor invokes a template, what's shown never changes under any circumstances, the template's page may simply show this content without any usage information. An editor then knows that he or she can use the template by entering its name, enclosed in  and.

Template:Stub is an example of such a template.

The template documentation page
To create a template's documentation page, go to the template's page, for example Template:Sandbox, and add  at the end of the URL. You will then be ready to edit the documentation page.

Marking the documentation page
The first thing in a template documentation page should be a transclusion of the Documentation template, which has the effect of marking the documentation page as such on the page of the template to be documented.

See Documentation's documentation here.

High-level summary
The next thing should be a high-level summary of the template's results. For example, "Template:Example displays a table of all available Dungeoneering items made with a certain material."

Parameter descriptions
Templates that use parameters need to have a summary of how to specify and use each of the parameters. A template's parameters may be numbered or named, or both. Additionally, the value may need to be in a certain format for the template to use it; this format also needs to be mentioned. Template:Coins, for example, expects its parameter to have no commas.

Numbered parameters
Template:FloorNumber is an example of a template that uses a numbered parameter. Since it has only one numbered parameter, it does not need to specify which parameter comes first, but its documentation needs to state that the parameter has no name= prefix. Otherwise, an editor could try  and fail to produce the correct result.

See FloorNumber's documentation here.

Named parameters
Most infobox templates on the wiki are examples of templates that use named parameters. Each parameter produces a cell in the infobox's table, and their order doesn't matter, only their presence in the parameter list. The function of each named parameter should be in its own section in the documentation page. The name of the section should match the name of the parameter; for example, documenting  would be at Template:Foo/doc, starting with.

See Infobox Item's documentation here.

Templates with lots of named parameters
If a template has a lot of named parameters, like Template:Infobox Item, it may be helpful to provide an invocation of the template with all of its parameters already present but not filled in, inside a  tag. This way, an editor who knows what the template's name is but not all of its parameters can visit its page and copy-paste an invocation on a page.

Preloads
Another helpful thing to provide if a template has lots of named parameters is a preload for the template.

Usage examples
Templates with parameters should have, following the description of each parameter, a few examples to demonstrate the combinations available and the results they produce.

For example, Template:Block can accept a numbered parameter, but its presence is not required; Template:Closure, to request the closure of a discussion, can accept one or two parameters, and the meaning of its first parameter is special when it is in a list of recognised words.

See Block's documentation and Closure's documentation.