Help:Magic words
From The Book of THoTH (Leaves of Wisdom)
{{H:h Template:SUBJECTSPACE|{{{1|}}}}} 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.
Contents |
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}} = Template:LC:AbC dEf
| [MW1.5+] LowerCase |
| {{UC:}} | {{UC:aBc DeF}} = Template:UC:aBc DeF
| [MW1.5+] UpperCase |
| {{LCFIRST:}} | {{LCFIRST:Ab Cd}} = Template:LCFIRST:Ab Cd
| [MW1.5+] LC first char. |
| {{UCFIRST:}} | {{UCFIRST:aB cD}} = Template:UCFIRST:aB cD
| [MW1.5+] UC first char. |
Template modifiers
The unmodified precedences for names without namespace prefix are magic word before template name before MediaWiki message name.
| 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}} | Show {{MediaWiki:xyz}} or <xyz>, not template {{xyz}}. Examples: {{int:edit}} = Edit, {{int:UTC}} = <UTC>, {{MediaWiki:UTC}} = MediaWiki:UTC. |
| {{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:}} Template: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}} | Template:CURRENTDAY2
| [MW1.5+] Ditto with leading zero 01 .. 31). |
| {{CURRENTDAYNAME}} | Sunday
| Displays the current day in named form. |
| {{CURRENTDOW}} | 0
| Ditto as number (0=Sunday, 1=Monday...). |
| {{CURRENTMONTH}} | 11
| The number 01 .. 12 of the current month. |
| {{CURRENTMONTHABBREV}} | Nov
| [MW1.5+] Ditto abbreviated Jan .. Dec. |
| {{CURRENTMONTHNAME}} | November
| Ditto in named form January .. December. |
| {{CURRENTMONTHNAMEGEN}} | November
| Genitive form of CURRENTMONTHNAME used for languages like Template:Unclear [2] |
| {{CURRENTTIME}} | 01:22
| The current time of day (00:00 .. 23:59). |
| {{CURRENTWEEK}} | 47
| Number of the current week (1-53) according to ISO 8601 with no leading zero. |
| {{CURRENTYEAR}} | 2009
| Returns the current year. |
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}} | Template:SUBPAGENAME
| [MW1.6+] Returns the name of the current page, excluding parent pages ("Title/Subtitle" becomes "Subtitle"). |
| {{BASEPAGENAME}} {{BASEPAGENAMEE}} | Template:BASEPAGENAME
| [MW1.7+] The basename of a subpage ("Title/Subtitle" becomes "Title") |
| {{NAMESPACE}} {{NAMESPACEE}} | Help
| Returns the name of the namespace the current page resides in. |
| {{FULLPAGENAME}} {{FULLPAGENAMEE}} | Template:FULLPAGENAME
| [MW1.6+] Shorthands for NAMESPACE+PAGENAME |
| {{REVISIONID}} | 2339
| [MW1.5+] The unique identifying number of a page, see Help:Diff. |
| {{SITENAME}} | The Book of THoTH (Leaves of Wisdom)
| Value of $wgSitename. |
| {{NS:}} | {{NS:4}} = The_Book_of_THoTH_(Leaves_of_Wisdom){{NS:PROJECT}} = The_Book_of_THoTH_(Leaves_of_Wisdom)
| Returns the name of a given namespace number. |
| {{LOCALURL:x y}} {{LOCALURLE:%}} | /thebook/index.php/X_y
| Returns the local URL of a given page. The page might not exist. |
| {{SERVER}} | http://www.book-of-thoth.com | Value of $wgServer |
| {{FULLURL:x y}} {{FULLURLE:x y}} | Template:Fullurl:x y Template:Fullurle:x y | [MW1.5+] Returns the full URL of a given page. |
| {{SCRIPTPATH}} | /thebook
| [MW1.5+] $wgScriptPath. |
| {{SERVERNAME}} | www.book-of-thoth.com
| [MW1.5+] $wgServerName. |
| {{TALKSPACE}} {{TALKSPACEE}} | Template:TALKSPACE
| [MW1.7+] Name of next odd namespace (e.g. 4 => 5) |
| {{SUBJECTSPACE}} {{SUBJECTSPACEE}} | Template:SUBJECTSPACE
| [MW1.7+] Name of next even namespace (e.g. 5 => 4) |
| {{ARTICLESPACE}} {{ARTICLESPACEE}} | Template:ARTICLESPACE
| [MW1.7+] An alias for SUBJECTSPACE(E) |
| {{TALKPAGENAME}} {{TALKPAGENAMEE}} | Template:TALKPAGENAME
| [MW1.7+] FULLPAGENAME in its TALKSPACE |
| {{SUBJECTPAGENAME}} {{SUBJECTPAGENAMEE}} | Template:SUBJECTPAGENAME
| [MW1.7+] FULLPAGENAME in its SUBJECTSPACE |
| {{ARTICLEPAGENAME}} {{ARTICLEPAGENAMEE}} | Template:ARTICLEPAGENAME
| [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 Template: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 | Usage | Explanation |
|---|---|---|
| {{DISPLAYTITLE}} | Template:DISPLAYTITLE
| [MW 1.7+] Template:Unclear [3] |
| {{NUMBEROFARTICLES}} {{NUMBEROFARTICLES|R}} | 1,874Template:NUMBEROFARTICLES
| A variable which returns the total number of articles on the Wiki. |
| {{NUMBEROFPAGES}} {{NUMBEROFPAGES|R}} | Template:NUMBEROFPAGESTemplate:NUMBEROFPAGES
| [MW1.7+] Returns the total number of pages. [4] |
| {{NUMBEROFFILES}} {{NUMBEROFFILES|R}} | 1,406Template:NUMBEROFFILES
| [MW1.5+] Returns the number of uploaded files (rows in the image table). |
| {{NUMBEROFUSERS}} {{NUMBEROFUSERS|R}} | Template:NUMBEROFUSERSTemplate:NUMBEROFUSERS
| [MW1.7+] Returns the number of registered users (rows in the user table). |
| {{CURRENTVERSION}} | Template:CURRENTVERSION
| [MW1.7+] Returns the current version of MediaWiki being run. [5] |
| {{grammar:case | word }} | {{grammar:7sg|Wikipedie}} outputs Wikipedií.
| Derived word forms in inflected languages like Czech [6] |
| {{plural:count |form1 |form2 }} {{plural:count |1st | 2nd | 3rd }} | {{plural: 2 | is | are }} outputs Template:Plural: 2{{plural: 0 | this | these }} outputs Template:Plural: 0
| count 1 yields form1 (singular), plural transformations are used for languages like Russian [7] based on "count mod 10". |
| #redirect | #REDIRECT [[target]]at top of source page | Creates a redirect to another page. |
See also
- Parser functions #expr:, #if:, #ifeq:, etc.
- Source for Language.php
- Source for MagicWord.php
Template:H:f


