Help:Magic Words

From Federation of Earth Science Information Partners
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Magic words are a set of predefined variables that Mediawiki uses.

Table of Contents

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__).


Word Example Explanation
{{CURRENTDAY}} 29 Displays the current day in numeric form.
{{CURRENTDAYNAME}} Monday Displays the current day in named form.
{{CURRENTDOW}} 1 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.
{{CURRENTTIME}} 21:08 The current time of day (00:00 .. 23:59).
{{CURRENTWEEK}} 48 Number of the current week (1-53) according to ISO 8601 with no leading zero.
{{CURRENTYEAR}} 2021 Returns the current year.

Page names, locations, and URLs

Word Example Explanation
{{PAGENAME}} Magic Words Returns the name of the current page, including all levels (Title/Subtitle/Sub-subtitle).
{{NAMESPACE}} Help Returns the name of the namespace the current page resides in.
{{SERVER}} Value of $wgServer

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.
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.
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).

These are short instructions. For a more detailed version see [h Meta.Wikimedia].

If this terse instruction set is unclear or inadequate, users are requested to fix it. Thanks.