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 of the page. They are written as a magic word wrapped with double underscores.

Variables
The syntax of variables 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".

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 of constant. The default values are: