Help:Magic words

This is an archived version of this page, as edited by BozoTheScary (talk | contribs) at 14:38, 7 June 2006 (Time: CURRENTWEEK Explanation from Wikipedia). It may differ significantly from the current version.

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

For details see Help:Section
Word Explanation
__NOTOC__ Hides ToC on the current page.
__FORCETOC__ Forces the table of contents to appear.
__TOC__ Places a ToC here (overriding any __NOTOC__).


More magic

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


Formatting

For details see Help:Colon function
Word Example Explanation
{{lc:}} {{lc:AbC dEf}} = abc def [MW1.5+] LowerCase
{{uc:}} {{uc:aBc DeF}} = ABC DEF [MW1.5+] UpperCase
{{lcfirst:}} {{lcfirst:Ab Cd}} = ab Cd [MW1.5+] LC first char.
{{ucfirst:}} {{ucfirst:aB cD}} = AB cD [MW1.5+] UC first char.

Template modifiers

Usage Explanation
{{:xyz}} A bare colon is no template modifier, it's the prefix for the main namespace. Test e.g. article {{:UTC}} vs. template {{UTC}}
{{int:xyz}} Shorthand for {{MediaWiki:xyz}}, rendered as ⧼xyz⧽ if MediaWiki:xyz doesn't exist. See Help:MediaWiki namespace.
{{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.
{{msgnw:xyz}} The unevaluated wikitext is rendered. See msgnw.
{{raw:xyz}} [MW1.6+] Like {{msg:}} [unclear] [1]
{{subst:xyz}} In the wikitext, the tag is substituted by the content (single-level evaluation only), see Help:Substitution.

Time

For details see Help:Variable
Word Example Explanation
{{CURRENTDAY}} 22 Displays the current day in numeric form.
{{CURRENTDAY2}} 22 [MW1.5+] Ditto with leading zero 01 .. 31).
{{CURRENTDAYNAME}} Wednesday Name of the day in the language of the project or English.
{{CURRENTDOW}} 3 Ditto as number (0=Sunday, 1=Monday...).
{{CURRENTMONTH}} 10 The number 01 .. 12 of the month.
{{CURRENTMONTHABBREV}} Oct [MW1.5+] Ditto abbreviated Jan .. Dec.
{{CURRENTMONTHNAME}} October Ditto in named form January .. December.
{{CURRENTTIME}} 04:42 The current time (00:00 .. 23:59).
{{CURRENTWEEK}} 43 Number of the current week (1-53) according to ISO 8601 with no leading zero.
{{CURRENTYEAR}} 2025 Returns the current year.
{{CURRENTTIMESTAMP}} 20251022044254 [MW1.7+] ISO 8601 time stamp.

Page names, locations, and URLs

For details see Help:Variable
Word Example Explanation
{{PAGENAME}} Magic words Returns the name of the current page, including all levels (Title/Subtitle/Sub-subtitle).
{{PAGENAMEE}} Magic_words More URL-friendly percent encoded special characters (To use an articlename in an external link).
{{SUBPAGENAME}}
{{SUBPAGENAMEE}}
Magic words
Magic_words
[MW1.6+] Returns the name of the current page, excluding parent pages ("Title/Subtitle" becomes "Subtitle").
{{BASEPAGENAME}}
{{BASEPAGENAMEE}}
Magic words
Magic_words
[MW1.7+] The basename of a subpage ("Title/Subtitle" becomes "Title")
{{NAMESPACE}}
{{NAMESPACEE}}
Help
Help
Returns the name of the namespace the current page resides in.
{{FULLPAGENAME}}
{{FULLPAGENAMEE}}
Help:Magic words
Help:Magic_words
[MW1.6+] Shorthands for NAMESPACE+PAGENAME
{{REVISIONID}} - [MW1.5+] The unique identifying number of a page, see Help:Diff.
{{SITENAME}} Meta-Wiki Value of $wgSitename.
{{ns:}} {{ns:4}} = Meta
{{ns:project}} = Meta
Returns the name of a given namespace number.
{{localurl:x y}}
{{localurle:%}}
/wiki/X_y
/wiki/%25
Returns the local URL of a given page. The page might not exist.
{{urlencode: x y %@ }} x+y+%25%40 [MW1.7+] To use a variable (parameter in a template) with spaces in an external link. [2]
{{SERVER}} //meta.wikimedia.org Value of $wgServer
{{fullurl:x y}}
{{fullurle:x y}}
//meta.wikimedia.org/wiki/X_y
//meta.wikimedia.org/wiki/X_y
[MW1.5+] Returns the full URL of a given page.
{{SCRIPTPATH}} /w [MW1.5+] $wgScriptPath.
{{SERVERNAME}} meta.wikimedia.org [MW1.5+] $wgServerName.
{{TALKSPACE}}
{{TALKSPACEE}}
Help talk
Help_talk
[MW1.7+] Name of next odd namespace (e.g. 4 => 5)
{{SUBJECTSPACE}}
{{SUBJECTSPACEE}}
Help
Help
[MW1.7+] Name of next even namespace (e.g. 5 => 4)
{{ARTICLESPACE}}
{{ARTICLESPACEE}}
Help
Help
[MW1.7+] An alias for SUBJECTSPACE(E)
{{TALKPAGENAME}}
{{TALKPAGENAMEE}}
Help talk:Magic words
Help_talk:Magic_words
[MW1.7+] FULLPAGENAME in its TALKSPACE
{{SUBJECTPAGENAME}}
{{SUBJECTPAGENAMEE}}
Help:Magic words
Help:Magic_words
[MW1.7+] FULLPAGENAME in its SUBJECTSPACE
{{ARTICLEPAGENAME}}
{{ARTICLEPAGENAMEE}}
Help:Magic words
Help:Magic_words
[MW1.7+] An alias for SUBJECTPAGENAME(E)

Image modifiers

For details see w:en: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=0]] Manualthumb [unclear]
width px [[Image:Mediawiki.png|40px]] Scales image to given width  in pixels

Position

For details see Help:Images_and_other_uploaded_files

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}} Template:DISPLAYTITLE  [MW 1.7+] [unclear] [3]
{{CURRENTVERSION}} 1.45.0-wmf.23 (441bb15) [MW1.7+] Returns the current version of MediaWiki being run. [4]
{{NUMBEROFARTICLES}}
{{NUMBEROFARTICLES|R}}
159,128
Template:NUMBEROFARTICLES
A variable which returns the total number of articles on the Wiki.
{{NUMBEROFPAGES}}
{{NUMBEROFPAGES|R}}
12,794,326
Template:NUMBEROFPAGES
[MW1.7+] Returns the total number of pages. [5]
{{NUMBEROFFILES}}
{{NUMBEROFFILES|R}}
1,874
Template:NUMBEROFFILES
[MW1.5+] Returns the number of uploaded files (rows in the image table).
{{NUMBEROFUSERS}}
{{NUMBEROFUSERS|R}}
44,921,572
Template:NUMBEROFUSERS
[MW1.7+] Returns the number of registered users (rows in the user table).
{{DIRMARK}}
{{DIRECTIONMARK}}

[MW1.7+] u+200E left to right or u+200D right to left mark
{{#language:}} {{#language:da}} = dansk Gives the local name of a language code.
#redirect #REDIRECT [[target]]
at top of source page
Creates a redirect to another page.

Project-dependent word conversions

Word Example Explanation
{{ CURRENTMONTHNAMEGEN }} October Genitive form of CURRENTMONTHNAME used for languages like [unclear] [6]
{{grammar:case | word }} {{grammar:7sg|Wikipedie}}
on cs: is Wikipedií.
Derived word forms in inflected languages like Czech [7]
{{plural:count |form1 |form2 }}
{{plural:count |1st | 2nd | 3rd }}
{{plural: 2 | is | are }}
outputs are
{{plural: 0 | this | these }}
outputs these
count 1 yields form1 (singular), plural transformations are used for languages like Russian [8] based on "count mod 10".

"Grammar" and "Plural" are project-dependent functions, defined in [9], [10], 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 project-dependent switch function, e.g. giving the first text if count = 1, the second if count = 2,3, or 4, and else the third. See also mediazilla:5805 for the use of "plural" in system messages.

See also

Help contents
Meta · Wikinews · Wikipedia · Wikiquote · Wiktionary · Commons: · Wikidata · MediaWiki · Wikibooks · Wikisource · MediaWiki: Manual · Google
Versions of this help page (for other languages see further)
What links here on Meta or from Meta · Wikipedia · MediaWiki
Reading
Go · Search · Namespace · Page naming · Section · Backlinks · Redirect · Category · Image page · Special pages · Printing
Tracking changes
Recent changes (enhanced) | Related changes · Watching pages · Diff · Page history · Edit summary · User contributions · Minor edit · Patrolled edit
Logging in and preferences
Logging in · Preferences
Editing
Starting a new page · Advanced editing · Editing FAQ · Export · Import · Shortcuts · Edit conflict · Page size
Referencing
Links · URL ·  · Footnotes
Style and formatting
Wikitext examples · CSS · Reference card · HTML in wikitext · Formula · Lists · Table · Sorting · Colors · Images and file uploads
Fixing mistakes
Show preview · Reverting edits
Advanced functioning
Expansion · Template · Advanced templates · Parser function · Magic words · System message · Substitution · Arrays · Expr parser function syntax · Transclusion
Others
Special characters · Renaming (moving) a page · Preparing a page for translation · Talk pages · Signatures · Sandbox · Legal issues for editors
  
Other languages: