Help:Magic words

Wiki Help Tables and templates  Magic words


 * Much of the information on this page explains options for users who wish to create templates with advanced features. Most users will only be interested in some of the behavior switches listed below.

Magic words (which include parser functions, variables and behavior switches) are features of wikitext that enable various instructions to be given to the MediaWiki software (for example, to suppress or position the table of contents), or else serve to produce variable output, as is often required in templates.

A quick reference for magic words can be found on this page. For more complete and updated documentation, refer to following pages on the MediaWiki site:


 * for all standard magic words, including the "standard" parser functions
 * for some additional parser functions, including conditional expressions

General information
There are three types of magic words:


 * Behavior switches - uppercase words surrounded by double underscores, e.g.  , or keywords using parser function syntax


 * Variables - uppercase words surrounded by double braces, e.g.   (thus resembling templates)


 * Parser functions - keywords (some beginning #) in double braces with parameters after a colon, e.g.  

Some magic words are case-insensitive, but not all. Whitespace is stripped from the start and end of keywords and parameters, as in template syntax. Page-dependent magic words will affect or return data about the current page, even if the word is added through a transcluded template or included system message. It is possible to substitute parser functions and variables in the same way that templates are substituted (using the subst: keyword). This causes their current value (as evaluated at the time of substitution) to be written into the wikitext.

Behavior switches
For documentation, refer to the section of the MediaWiki page.

Variables
For documentation, refer to the section of the MediaWiki page.

The above can all take a parameter, to operate on a page other than the current page.

Parser functions
These are documented at the unless otherwise stated.

Metadata
Add |R to return numbers without commas.

Conditional expressions
These are covered at the. Some parameters are optional.

For the use of these functions in tables, see Conditional tables.