This is a copy of the master help page at Meta. Do not edit this copy.
Edits will be lost in the next update from the master page. See below for more information.
This is an organized index of Magic words used in MediaWiki.
A "magic word" is a symbol recognized by the MediaWiki software and which when seen in the non-commented text of the page, triggers the software to do something other than display that symbol, or transclude a page with that name, but instead to use the symbol directly.
A magic word can be:
an upper case word, preceded and followed by two underscores, e.g. __NOTOC__
an XML object, coded similar to HTML, preceded by "<" (and for the end tag "/") and followed by ">", as in <nowiki>...</nowiki>
a parser function: similar to a template, a word preceded by the symbols "{{" and followed by "}}", and optionally parameter definitions between pipe characters, except that the part before the first pipe (or without pipes, the text between the braces) contains a colon (":"), e.g. {{ns:3}} and {{#ifexpr:{{{1}}}>3|large|small}}
a variable: similar to a template without parameters, a word preceded by the symbols "{{" and followed by "}}", except the word used is in all upper case, e.g. {{CURRENTDAY}}
a template modifier
an image modifier
If a page in the template namespace has the same name as a magic word, the magic word will be invoked instead. If you discover you absolutely have to define a template with the same name as a magic word, prefix the name of the template with "msg:" or the name of the template namespace ("Template:"). See below for further details if you need this feature.
Tags which are used on this page such as "[MW1.5+]" indicate the MediaWiki version that first supported the magic word. "XYZ" indicates user input, which is used in the example.
Places a ToC here (overriding any __NOTOC__). Multiple ToCs are no longer supported. If __TOC__ is used multiple times, only the first occurrence causes a ToC to appear.
Other
Word
Explanation
__NOEDITSECTION__
Hides the edit links beside headings. Also, will no longer automatically edit only one section at a time when double- or right-clicking a heading (if you have that feature enabled in your preferences)
__NEWSECTIONLINK__
[MW1.7+] Gives a "+"-link next to the edit-tab to make a new section on a non-talk page (post-a-comment feature).
__NOCONTENTCONVERT__
__NOCC__
Don't perform the content language conversion (character and phase) in article display; for example, Chinese zh with zh_cn, zh_tw, zh_sg, zh_hk.
__NOGALLERY__
[MW1.7+] This magic word allows images in category pages to be displayed as inline links instead of gallery.
__NOTITLECONVERT__
__NOTC__
Like __NOCC__ but affecting article title only.
__END__
Allows for trailing whitespace to be included in the page save (does not seem to work anymore).
__START__
This magic word has no effect but an ID in MagicWord.php (MAG_START).
__HIDDENCAT__
When placed anywhere on a category page, this magic word causes that category not to appear in the horizontal box near the bottom of every member page. See Help:Category#Hidden_categories for further detail.
XML-style tags
XML-style tags use the syntax <tag name>contents</tag name>. XML-style tags are frequently used by MediaWiki extensions; see Extending wiki markup for details on adding new tags.
Default
The following tags are available in a default MediaWiki installation.
parsing is the conversion of text markup and XHTML to formatting and structure like templates, links, formatting, line breaks, et cetera. Two tags affect parsing:
nowiki disables parsing of all wiki syntax. For example, "<nowiki>'''[[{{tc}}]]'''</nowiki>" gives "'''[[{{tc}}]]'''".
pre mimics nowiki above in a formatted box, and preserves new lines. For example, "<pre>'''[[{{tc}}]]'''</pre>" outputs as:
'''[[{{tc}}]]'''
transclusion is adding the content of one page to another using the {{...}} template syntax. Three tags affect transclusion:
noinclude prevents text from appearing when the page is transcluded, so the text will only be visible on the current page. For example, "<noinclude>[[Category:Foo]]</noinclude>" will only categorize the template page.
includeonly hides text on the current page, so that it will only appear when the page is transcluded. For example, "<includeonly>[[Category:Foo]]</includeonly>" will categorize all pages that transclude the template, but not the template itself.
onlyinclude hides all other text when the page is transcluded, so that only the text inside the onlyinclude tags will be shown. For example, "I am an <onlyinclude>apple</onlyinclude>." will output "apple" when transcluded.
math uses TeX markup to generate complex mathematics, usually in image form (see Help:Displaying a formula). For example, "<math>\sqrt{a^2+b^2}</math>" outputs as .
Common extensions
hiero (WikiHiero extension) uses the Hieroglyph coding manual syntax to generate images of hieroglyphs. For example, "<hiero>A1</hiero>" outputs as
.
categorytree (CategoryTree extension) uses custom syntax to create a dynamic view of the category structure. See the extension page for examples.
The time in UTC. Note that if the page was displayed by the same user and has not changed (has not been edited) since the last time it was displayed, it is possible that the page may be cached (by the user's browser) and the displayed time or date may not change. Also, if a heavily used page, rather than freshly rendered by the software each time it is generated, is instead being retrieved from a caching system (such as the main page on Wikipedia) the date or time may not change from the last time the page was originally retrieved by the caching hardware or software.
Word
Example
Explanation
{{CURRENTDAY}}
26
Displays the current day in numeric form.
{{CURRENTDAY2}}
26
[MW1.6+] Same as {{CURRENTDAY}}, but with leading zero (01 .. 31).
{{CURRENTDAYNAME}}
Saturday
Name of the day in the language of the project or English.
{{CURRENTDOW}}
6
Same as {{CURRENTDAYNAME}}, but as a number (0=Sunday, 1=Monday...).
{{CURRENTMONTH}}
07
The number 01 .. 12 of the month.
{{CURRENTMONTHABBREV}}
Jul
[MW1.5+] Same as {{CURRENTMONTH}}, but in abbreviated form (Jan .. Dec).
{{CURRENTMONTHNAME}}
July
Same as {{CURRENTMONTH}}, but in named form (January .. December).
{{CURRENTTIME}}
08:39
The current time (00:00 .. 23:59).
{{CURRENTHOUR}}
08
The current hour (00 .. 23).
{{CURRENTWEEK}}
30
Number of the current week (1-53) according to ISO 8601 with no leading zero.
[MW1.7+] Changes the decimal separator and adds digit group separators (before the decimal separator only) according to the wiki's default locale. Also changes the digits into the local script. Leading minus and plus are recognized.
First case is, for example, applicable to years in a category... giving an ordered year to sort by pipetricks order, or any such ordering where left extended zeros allow a proper sorting.
[MW1.8+] Pads a string with a character to the specified width. Note that there's a little bug that interprets non-US-ASCII characters as two, instead of one character (see the difference in café and cafe in the examples.)
It does not seem possible to use padleft and padright for padding with characters with a multi-character code, such as , which would be useful with padleft for sorting tables with Javascript.
Also, giving a non-ASCII character as a character to replicate results in a "?" character. bugzilla:12324
[MW1.12+, r29482] Passes attributes and inner content to an XML-style parser tag, parsing template variables along the way. See Bug 2257 and Extension:TagParser.
A bare colon is not a template modifier, it's the prefix for the main namespace. Test e.g. article {{:UTC}} vs. template {{UTC}}.
Using this syntax you include the text of the main namespace article xyz in another article.
{{int:xyz}}
Same as {{MediaWiki:xyz}}, except standard message translation is applied depending on subpages and content/user/uselang language. Another difference is: this doesn't appear under "Pages transcluded onto the current version of this page:". Rendered as <xyz> if MediaWiki:xyz doesn't exist. See also Help:System message.
{{msg:xyz}}
Even if there is a magic word named "xyz", use template:xyz unless the template doesn't exist (equivalent to {{template:xyz}}). Normally, magic words have priority when there is a conflict.
{{msgnw:xyz}}
The unexpanded wikitext is rendered (more or less, for details see msgnw).
These are image modifiers used in [[Image:title.ext|modifier|...|modifier]] links. Some are mutually exclusive, and then the last specified wins. The last unrecognized modifier is used as caption for framed images or together with thumbnails. It's also used as description alt=text.
Size
Word
Usage
Explanation
framed
frame
enframed
[[Image:Mediawiki.png|framed]]
Places an image in a frame with a description. Uses original size and stubbornly ignores width parameter if given.
In general, far better to use thumb, as is only suitable for small images.
border
[[Image:Mediawiki.png|border]]
Shows a 1px border around the image.
thumbnail
thumb
[[Image:Mediawiki.png|thumbnail]]
Modifies image size, sets it dependent on user's favorite thumbnail size in one's preferences, or on the given width parameter (see below).
thumb=xyz
[[Image:Mediawiki.png|thumb=Wiki.png]]
Manualthumb: instead of displaying an automatically-sized thumbnail for Mediawiki.png, display the image Wiki.png.
Scales image to given width in pixels
Scales image to no more than 100 pixels wide and no more than 200 high, but image scaled to retain its true aspect ratio within the boundary specified.
The positions are mutually exclusive; the last specified wins. Template:- can stop floating. For inline images only modifier px (see above) is supported.
Word
Usage
Explanation
right
[[Image:Mediawiki.png|right]]
Modifies position, floats the image to the right.
left
[[Image:Mediawiki.png|left]]
Modifies position, floats the image to the left.
none
[[Image:Mediawiki.png|none]]
Explicitly states that the image should not float.
center
centre
[[Image:Mediawiki.png|center]]
Modifies position, like none but centered.
Miscellany
Word
Example
Explanation
{{DISPLAYTITLE:xyz}}
[MW 1.7+] Set the page's title [5], enabled in Wikimedia projects since June 2007 ([6]). Also see $wgAllowDisplayTitle.
{{DIRMARK}}
{{DIRECTIONMARK}}
[MW1.7+] u+200E left to right or u+200D right to left mark
{{CONTENTLANGUAGE}}
en
[MW1.7+] code of the site's default interface language ($wgLanguageCode)
{{DEFAULTSORT:xyz}}
{{DEFAULTSORT:xyz}}
[MW1.10+] Sets a default category sort key for the whole current page (also applying for category tags before this tag)[2].
#REDIRECT
#REDIRECT [[target]]
at top of source page
Creates a redirect to another page (to the target page).
Language-dependent word conversions
Word
Example
Explanation
{{ CURRENTMONTHNAMEGEN }}
July
Genitive form of month name used for Czech, Polish, Ukrainian[7]
{{plural: 2 | is | are }}
outputs are
{{plural: 1 | this | these }}
outputs this
{{plural: 0 | his | their }}
outputs their
count1 yields form1 (singular), plural transformations are used for languages like Russian[9] based on "count mod 10".
"Grammar" and "Plural" are language-dependent functions, defined in [10], [11], etc. (note that in PHP, the modulo operator is the percent sign).
"Grammar" can either be applied to predefined words only, or to arbitrary words, depending on whether the definition is just a 2D array, or involves string manipulations. See also cs:Šablona:Wikivar/GRAMMAR.
"Plural" is a site-language-dependent switch function, controlled by function convertPlural in Language.php (which distinguishes between 1 and "not 1"), for some languages overridden in Languagexx.php, e.g. for French (which distinguishes between <=1 and >1) and Russian (oddly, first option is 1, 21, 31,.., 91, 101, 121, .., second is 2, 3, 4, 22, 23, 24, 31, 32, 33, 41,.., 94, 102, 103, 104,.., 122, 123,.., and else the third).
As opposed to ParserFunctions, "plural" accepts points and commas in numbers and interprets them in a site-language-specific way (depending on $separatorTransformTable in Messagesxx.php); on this site:
{{plural:1.000|a|b|c}} gives a
{{plural:1,000|a|b|c}} gives b
(on e.g. the German and the Dutch sites reversed w.r.t. the result on English sites).
"Plural" is used in various system messages, e.g. message with id 'nmembers' (talk), where it uses interface language instead of site language.
There are no known magic words working only for Wikipedia, or working on Meta but not here As of 2007at the moment.
This page is a copy of the master help page at Meta (for general help information all Wikimedia projects can use), with two Wikipedia-specific templates inserted. To update the main text, edit the master help page for all projects at m:Help:Magic words. For Wikipedia-specific issues, use Template:Ph:Magic words (the extra text at the bottom of this page) or Template:Phh:Magic words for a Wikipedia-specific lead (text appears at the top of this page). You are welcome to replace the full wikitext of this page with that of the master page at Meta at any time. To view this page in other languages see the master page at Meta.