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.

There are three general types of magic words:
 * Behavior switches: these are uppercase words surrounded by double underscores (eg __FOO__)
 * Variables: these are uppercase words surrounded by double braces (eg  ). As such, they look a lot like templates
 * Parser functions: these take parameters and are either of the form   or   .

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.

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.

Variables
Variables return information about the current page, wiki, or date. Their syntax is similar to templates. If a template name conflicts with a variable, the variable will be used (so to transclude the template    :PAGENAME you would need to write  ). In some cases, adding parameters will force the parser to treat a variable as a template; for example,  transcludes     :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 normally contain separators (commas or spaces, depending on the local language), but can return raw numbers with the ":R" flag (for example,  &rarr;  and   &rarr; ). 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:




 * Outputs a unicode-directional mark that matches the wiki's default language's direction ( on left-to-right wikis,   on right-to-left wikis), useful in text with multi-directional text.
 * 1.7+

Parser functions
Parser functions are very similar to variables, but operate on user input instead of the current page.

This page only describes parser functions that are integral to the MediaWiki software. Other parser functions may be added by MediaWiki extensions such as the.


 * Format the current page's title header. The value must be equivalent to the default title: only capitalization changes and replacing spaces with underscores. It can be disabled or enabled by ; disabled by default before 1.10+, enabled by default thereafter.
 * 1.7+
 * Used on a categorized page, sets a default category sort key.
 * 1.10+
 * Returns the byte size of the specified page.
 * Used on a categorized page, sets a default category sort key.
 * 1.10+
 * Returns the byte size of the specified page.
 * Returns the byte size of the specified page.
 * Returns the byte size of the specified page.
 * Returns the byte size of the specified page.
 * Returns the byte size of the specified page.

( used here)
 * Number of pages in the given category (replace "Help" with the relevant category name).
 * Number of users in a specific.
 * colspan="4"| Per namespace
 * colspan="4"| Per namespace
 * colspan="4"| Per namespace
 * not enabled
 * Number of pages in the given namespace (replace 2 with the relevant namespace ID). E.g. equals the number of categories.  Disabled by default, enable with.
 * 1.7+

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