Help:Magic words
Anonymous editing has been temporarily disabled. Please create an account in order to leave feedback or test wiki functionality.

Taken from http://meta.wikimedia.org/wiki/Help:Magic_words. Original content licensed under the GFDL.

This is an organised index of Magic words used in MediaWiki. Tags such as "[MW1.5+]" indicate the version that first supported the magic word. "XYZ" indicates user input, which is used in the example.

Table of contents

Word Explanation JAMWiki Status
__NOTOC__ Hides ToC on the current page. Supported
__FORCETOC__ Forces the table of contents to appear. Supported
__TOC__ Places a ToC here (overriding any __NOTOC__). Supported

More magic

Word Explanation JAMWiki Status
__NOEDITSECTION__ Hides the edit links beside headings. Unsupported
__NEWSECTIONLINK__ [MW1.7+] Gives a "+"-link next to the edit-tab to make a new section on a non-talk page. Unsupported
__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. Unsupported
__NOGALLERY__ [MW1.7+] This magic word allows images in category pages to be displayed as inline links instead of gallery. Unsupported
__NOTITLECONVERT__
__NOTC__
Like __NOCC__ but affecting article title only. Unsupported
__END__ Allows for trailing whitespace to be included in the page save. Unsupported
__START__ This magic word has no effect but an ID in MagicWord.php (MAG_START). Unsupported

Variables

Time

The time in UTC.

Word Example Explanation JAMWiki Status
{{CURRENTDAY}} 4 Displays the current day in numeric form. Supported
{{CURRENTDAY2}} 04 [MW1.6+] Same as {{CURRENTDAY}}, but with leading zero (01 .. 31). Supported
{{CURRENTDAYNAME}} Friday Name of the day in the language of the project or English. Supported
{{CURRENTDOW}} 1 Same as {{CURRENTDAYNAME}}, but as a number (0=Sunday, 1=Monday...). Supported
{{CURRENTMONTH}} 07 The number 01 .. 12 of the month. Supported
{{CURRENTMONTHABBREV}} Jul [MW1.5+] Same as {{CURRENTMONTH}}, but in abbreviated form as Jan .. Dec. Supported
{{CURRENTMONTHNAME}} July Same as {{CURRENTMONTH}}, but in named form January .. December. Supported
{{CURRENTTIME}} 12:31 The current time (00:00 .. 23:59). Supported
{{CURRENTHOUR}} 12 The current hour (00 .. 23). Supported
{{CURRENTWEEK}} 27 Number of the current week (1-53) according to ISO 8601 with no leading zero. Supported
{{CURRENTYEAR}} 2008 Returns the current year. Supported
{{CURRENTTIMESTAMP}} 20080704123124 [MW1.7+] ISO 8601 time stamp. Supported

Local time

The time depending on the local timezone of the wiki. (All words [MW1.8+] )

Word Example Explanation JAMWiki Status
{{LOCALDAY}} 4 Displays the local day of the month in numeric form. Supported
{{LOCALDAY2}} 04 Same as {{LOCALDAY}}, but with a leading zero (01 .. 31). Supported
{{LOCALDAYNAME}} Friday Name of the day in the language of the project or English. Supported
{{LOCALDOW}} 1 Same as {{LOCALDAYNAME}}, but as a number (0=Sunday, 1=Monday...). Supported
{{LOCALMONTH}} 07 The number 01 .. 12 of the month. Supported
{{LOCALMONTHABBREV}} Jul Same as {{LOCALMONTH}}, but in abbreviated form as Jan .. Dec. Supported
{{LOCALMONTHNAME}} July Same as {{LOCALMONTH}}, but in named form as January .. December. Supported
{{LOCALTIME}} 05:31 The local time (00:00 .. 23:59). Supported
{{LOCALHOUR}} 05 The local hour (00 .. 23). Supported
{{LOCALWEEK}} 27 Number of the local week (1-53) according to ISO 8601 with no leading zero. Supported
{{LOCALYEAR}} 2008 Returns the local year. Supported
{{LOCALTIMESTAMP}} 20080704053124 ISO 8601 time stamp. Supported

Statistics

Word Example Explanation JAMWiki Status
{{CURRENTVERSION}} 0.6.6 [MW1.7+] Returns the current Wiki version. Supported
{{NUMBEROFARTICLES}}
{{NUMBEROFARTICLES:R}}
NUMBEROFARTICLES
NUMBEROFARTICLES:R
A variable which returns the total number of articles on the Wiki. Unsupported
{{NUMBEROFPAGES}}
{{NUMBEROFPAGES:R}}
870
870
[MW1.7+] Returns the total number of pages. See here for details. Supported
{{NUMBEROFFILES}}
{{NUMBEROFFILES:R}}
370
370
[MW1.5+] Returns the number of uploaded files (rows in the image table). Supported
{{NUMBEROFUSERS}}
{{NUMBEROFUSERS:R}}
1,032
1032
[MW1.7+] Returns the number of registered users (rows in the user table). Supported
{{NUMBEROFADMINS}}
{{NUMBEROFADMINS:R}}
NUMBEROFADMINS
NUMBEROFADMINS:R
[MW1.7+] Returns the number of administrators (sysop, bureaucrat, steward and checkuser). Unsupported
{{PAGESINNAMESPACE}} PAGESINNAMESPACE Longer alias of PAGESINNS Unsupported
{{PAGESINNS:ns}}
{{PAGESINNS:ns:R}}
PAGESINNS:ns:R [MW1.7+] Returns the number of pages in the given namespace. Disabled by default, enable with Template:h:mwg. Unsupported

Page names and related info

Word Example Explanation JAMWiki Status
{{PAGENAME}} Magic words Returns the name of the current page, including all levels (Title/Subtitle). Supported
{{PAGENAMEE}} Magic_words More URL-friendly percent encoded special characters (To use an articlename in an external link). Supported
{{SUBPAGENAME}}
{{SUBPAGENAMEE}}
Magic words
Magic_words
[MW1.6+] Name of the current page, excluding parent pages ("Subtitle" on "Title/Subtitle") in namespaces supporting subpages, see Help:Link. Supported
{{BASEPAGENAME}}
{{BASEPAGENAMEE}}
Magic words
Magic_words
[MW1.7+] The basename of a subpage ("Title" on "Title/Subtitle"), see Help:Link. Supported
{{NAMESPACE}}
{{NAMESPACEE}}
Help
Help
Returns the name of the namespace the current page resides in. Supported
{{FULLPAGENAME}}
{{FULLPAGENAMEE}}
Help:Magic words
Help:Magic_words
[MW1.6+] Shorthands for NAMESPACE+PAGENAME Supported
{{TALKSPACE}}
{{TALKSPACEE}}
Help comments
Help_comments
[MW1.7+] Name of next odd namespace (e.g. 4 => 5) Supported
{{SUBJECTSPACE}}
{{SUBJECTSPACEE}}
Help
Help
[MW1.7+] Name of last even namespace (e.g. 5 => 4) Supported
{{ARTICLESPACE}}
{{ARTICLESPACEE}}
Help
Help
[MW1.7+] An alias for SUBJECTSPACE(E) Supported
{{TALKPAGENAME}}
{{TALKPAGENAMEE}}
Help comments:Magic words
Help_comments:Magic_words
[MW1.7+] FULLPAGENAME in its TALKSPACE Supported
{{SUBJECTPAGENAME}}
{{SUBJECTPAGENAMEE}}
Help:Magic words
Help:Magic_words
[MW1.7+] FULLPAGENAME in its SUBJECTSPACE Supported
{{ARTICLEPAGENAME}}
{{ARTICLEPAGENAMEE}}
Help:Magic words
Help:Magic_words
[MW1.7+] An alias for SUBJECTPAGENAME(E) Supported
{{REVISIONID}} REVISIONID [MW1.5+] The unique identifying number of a page, see Help:Diff. Unsupported
{{REVISIONDAY}} 29 [MW1.8+] The day on which the page was last modified. Supported
{{REVISIONDAY2}} 29 [MW1.8+] The day on which the page was last modified, but with a leading zero (01 .. 31). Supported
{{REVISIONMONTH}} 02 [MW1.8+] The month in which the page was last modified. Supported
{{REVISIONYEAR}} 2008 [MW1.8+] The year in which the page was last modified. Supported
{{REVISIONTIMESTAMP}} 20080229073352 [MW1.8+] ISO 8601 time stamp, indicating when the page was last modified. Supported
{{SITENAME}} SITENAME Value of Template:h:mwg. Unsupported
{{SERVER}} SERVER Value of Template:h:mwg Unsupported
{{SCRIPTPATH}} SCRIPTPATH [MW1.5+] Template:h:mwg Unsupported
{{SERVERNAME}} SERVERNAME [MW1.5+] Template:h:mwg Unsupported

Parser functions

Namespaces and URLs

Word Example Explanation JAMWiki Status
{{ns:}} {{ns:4}} = Template:ns:4
{{ns:project}} = Template:ns:project
Returns the name of a given namespace number. Unsupported
{{localurl:x y @}}
{{localurle:x y @}}
{{localurl:a|b=c}}
Template:localurl:x y @
Template:localurle:x y @
Template:localurl:a
Returns the local URL of a page (might not exist). Optional query parameter, see Help:Variable. Unsupported
{{urlencode:x y @}} Template:urlencode:x y @ [MW1.7+] Encodes variable values for use in external links. See here for details. Unsupported
{{anchorencode:x #y @}} Template:anchorencode:x #y @ [MW1.8+] Encodes variable values for use in external links. See here for details. Unsupported
{{fullurl:x y @}}
{{fullurle:x y @}}
{{fullurl:m:a|b=c}}
Template:fullurl:x y @
Template:fullurle:x y @
Template:fullurl:m:a
[MW1.5+] Returns the full URL of a given page. Optional query parameter as for localurl:. Unsupported

Formatting

Word Example Explanation JAMWiki Support
{{#language:}} {{#language:da}} = Template:#language:da [MW1.7+] Native name of language code. Unsupported
{{lc:}} {{lc:AbC dEf}} = Template:lc:AbC dEf [MW1.5+] LowerCase Unsupported
{{lcfirst:}} {{lcfirst:Ab Cd}} = Template:lcfirst:Ab Cd [MW1.5+] LC first char. Unsupported
{{uc:}} {{uc:aBc DeF}} = Template:uc:aBc DeF [MW1.5+] UpperCase Unsupported
{{ucfirst:}} {{ucfirst:aB cD}} = Template:ucfirst:aB cD [MW1.5+] UC first char. Unsupported
{{formatnum:}} {{formatnum:299792458}} = Template:formatnum:299792458 [MW1.7+] Add decimal separators according to the wiki's default locale. Unsupported
{{padleft:}}
{{padright:}}
{{padleft:bcd|6|a}} = Template:padleft:bcd
{{padright:bcd|6|a}} = Template:padright:bcd
[MW1.8+] Pads a string with a character to the specified width. Unsupported

Template modifiers

Usage Explanation JAMWiki Support
{{:xyz}} A bare colon is not a template modifier, it's the prefix for the main namespace. Test e.g. article {{:UTC}} vs. template {{UTC}} Supported
{{int:xyz}} Shorthand for {{MediaWiki:xyz}}, rendered as Template:int:xyz if MediaWiki:xyz doesn't exist. See Help:MediaWiki namespace. Unsupported
{{msg:xyz}} Try {{Template:xyz}} before magic word xyz, without this modifier it's the other way around. No additional effect if there is no template xyz. Unsupported
{{msgnw:xyz}} The unevaluated wikitext is rendered. See msgnw. Unsupported
{{raw:xyz}} [MW1.6+] Like {{msg:}} Template:unclear http://svn.wikimedia.org/viewvc/mediawiki?view=rev&revision=12925 Unsupported
{{subst:xyz}} In the wikitext, the tag is substituted by the content (single-level evaluation only), see Help:Substitution. Unsupported

Image modifiers

For details see wikipedia:Wikipedia:Extended image syntax.

These are image modifiers used in [[Image:title.ext|modifier|...|modifier]] links. Some are mutually exclusive, and then the last specified wins.

Size

The last unrecognized modifier is used as caption for framed images or together with thumbnails. It's also used as description alt=text.

Word Usage Explanation
framed
frame
enframed
[[Image:Mediawiki.png|framed]] Places an image in a frame with a description. Uses original size.
thumbnail
thumb
[[Image:Mediawiki.png|thumbnail]] Modifies image size, sets it to dependant on user's favourite thumbnail size in their preferences.
thumb=xyz [[Image:Mediawiki.png|thumb=Wiki.png]] Manualthumb: instead of displaying an automatically-sized thumbnail for Mediawiki.png, display the image Wiki.png.
width px [[Image:Mediawiki.png|40px]] Scales image to given width  in pixels

Position

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 JAMWiki Status
{{DISPLAYTITLE:xyz}} default disabled [MW 1.7+] Set the page's title per the spec, see Template:h:mwg. Unsupported
{{DIRMARK}}
{{DIRECTIONMARK}}
Template:DIRMARK
Template:DIRECTIONMARK
[MW1.7+] u+200E left to right or u+200D right to left mark Unsupported
{{CONTENTLANGUAGE}} Template:CONTENTLANGUAGE [MW1.7+] Default content Template:h:mwg Unsupported
#redirect #REDIRECT [[target]]
at top of source page
Creates a redirect to another page. Supported