Help:Magic words/yo

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 explains only the standard magic words; for a technical reference, see.

There are three general types of magic words:


 * Behavior switches: these are usually written as uppercase words surrounded by double underscores, e.g.  .
 * Variables: these are uppercase words surrounded by double braces, e.g.  . As such, they look a lot like templates.
 * Parser functions: these take parameters and are either of the form   or  , e.g. . See also and.

Variables and parser functions can use subst:, just like templates. Page-dependent magic words will affect or return data about the current page (by default), even if the word is added through a transcluded template or included system message.

Behavior switches
A behavior switch controls the layout or behavior of the page (if supported by the skin) and can often be used to specify desired omissions and inclusions in the content. Notably some of these are not supported by the Minerva skin.

Variables
Variables return information about the current page, wiki, or date. Their syntax is similar to templates. Variables marked as " [expensive] " are tracked by the software, and the number that can be included on a page is limited.

Ti orukọ awoṣe ba tako pẹlu oniyipada, oniyipada naa yoo ṣee lo (nitoribẹẹ lati paarọ awoṣe iwọ yoo nilo lati kọ ). Ni awọn igba miiran, fifi paramita kun yoo fi ipa mu parser lati pe awoṣe kan; fun apẹẹrẹ, $tpl-currentdayname-code transcludes $tpl-currentdayname-esi, kii ṣe oniyipada naa.

Date and time
The following variables return the current date and time in UTC.

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

The use of those variables cause pages to be cached for a more limited number of seconds. This is configured in MagicWordFactory.

The date and time magic words are formatted in the wiki content language. Since, they depend on the page content language.

The following variables do the same as the preceding ones but using the site's server config or.



For more thorough time formatting, or to output the current year and week with better compliance with ISO-8601, you may want to install to use the  parser function.

Statistics
Numbers returned by these variables normally contain separators (commas, dots or spaces, depending on the local language) but can return raw numbers with the ":R" flag (for example,  &rarr;  and   &rarr; ).

Lo "|R" fun awọn ọrọ idan ti o nilo paramita bi PAGESINCATEGORY (fun apẹẹrẹ $pic ati $pic-r, tabi $pic-subcats ati $pic-subcats-r). O tun wulo fun nihin tẹlẹ.

The number magic words are formatted in the wiki content language. Since, it depends on the page content language.

Page names
Ko si ọkan ninu iwọnyi ti o ni ipa nipasẹ awọn iyipada si akọle ifihan nipa lilo ; awọn iye ti o pada jẹ akọle oju-iwe atilẹba.

The  and   magic words only work in namespaces that have subpages enabled. See for information on enabling subpages.

As of 1.15+, these can all take a parameter, allowing specification of the page to be operated on, instead of just the current page:



URL encoded page names
The following are equivalents encoded for use in MediaWiki URLs (i.e. spaces replaced with underscores and some characters HTML escaped using numeric character encoding):



Note that,   and   have distinct implementations. See for details.

Namespaces
The following are equivalents encoded for use in MediaWiki URLs (spaces replaced with underscores and some characters percent-encoded):



As of 1.15+, these can take a full-page-name parameter and will return the requested namespace associated with that page, instead of with the current page:

Parameter must not be a namespace name:
 * &rarr; 
 * &rarr;  (Pages in main space will return empty)
 * &rarr; 
 * &rarr; 
 * &rarr; 
 * &rarr; 
 * &rarr;   (Empty)

Parser functions
Parser functions are very similar to variables but take one or more parameters (technically, any magic word that takes a parameter is a parser function), and the name is sometimes prefixed with a hash to distinguish them from templates.

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. For those see.

Namespaces
returns the current localized name for the namespace with that index, canonical name, or local alias. Thus,  , and   (an old name for the File namespace) all return "    ". On a wiki where the content language is French,  is also valid, but   (the localisation of "File" in German) is not.

The main namespace has no name, i.e.  returns an empty string. For explicitly referring to the main namespace,  can be used, resulting in "".

is the equivalent encoded for MediaWiki URLs. It does the same, but it replaces spaces with underscores, making it usable in external links.

Don't confuse localised namespaces with custom namespaces.

Formatting
See also:.

Localization
Here are the magic words which are used as main localisation tools. Other magic words will often depend on the wiki's locale and configuration or on the chosen language: see in particular #Date and time, #Formatting, #Miscellaneous. More magic words are added by the.

The usage of these magic words can be very complex, and the documentation is currently incomplete; there's some more info on PLURAL, GRAMMAR, GENDER.

Transclusion modifiers
maa n ṣe iyipada oju-iwe miiran, nipasẹ aiyipada lati Àdàkọ:namespace. These magic words modify that behavior.

Miscellaneous
For parser function #invoke, see w:Wikipedia:Lua.