Help:Magic words

Magic words are strings of text that MediaWiki associates with a return value or function, such as time, site details, or page names. This page is about usage of standard magic words; for a technical reference, see.

General notes

 * Inheritance: page-dependent magic words will affect or return data about the current page, regardless of whether it is in the page code or a transcluded template.

Behaviour switches
A behaviour switch controls the layout or behaviour of the page and can often be used to specify desired omissions and inclusions in the content. They are usually written as an uppercase word wrapped with double underscores.

Variables and parser functions
Variables return information about the current page, wiki, or date. Their syntax is similar to templates, but capitalized to help avoid conflicts. If a template has the same name and case as a variable, the variable will be used. Usage of the template can be forced by adding the "msg:" modifier (for example, " "). In some cases, adding parameters will force the parser to treat a variable as a template; for example,  tries to transclude "Template:CURRENTDAYNAME".

Parser functions are very similar to variables, but operate on user input instead of the current page. The first parameter is delimited by a colon instead of a pipe (|). (This page does not document custom parser functions added by the .)

Date & time
The following variables return the current date and time according to the user's timezone preferences, defaulting to the UTC timezone.

Due to MediaWiki and browser caching, these variables frequently show when the page was cached rather than the current time.

The following variables do the same as the above, but using the site's local timezone instead of user preferences and UTC:
 * 2024
 * August
 * 27
 * Tuesday
 * 27
 * Tuesday
 * Tuesday
 * Tuesday
 * Tuesday

Technical metadata
Revision variables return data about the latest edit to the current page, even if viewing an older version of the page.

Statistics
Numbers returned by these variables contain number separators, but can return raw numbers with the ":R" flag (for example,  =  and   = ). Use "|R" for magic words that require a parameter like PAGESINCATEGORY (for example  and  ).

Page names
The following are URL-encoded equivalents:

Namespaces
The following are URL-encoded equivalents:

returns the localized namespace name for that number constant. The default values are: