Help:Magic words

From Avon Lake Wiki
Jump to: navigation, search

Magic words are strings of text that MediaWiki associates with a return value or function, such as time, site details, or page names.

There are three general types of magic words:

  • Behavior switches: these are uppercase words surrounded by double underscores, e.g. __FOO__.
  • Variables: these are uppercase words surrounded by double braces, e.g. {{FOO}}.
  • Parser functions: these take parameters and are either of the form {{foo:...}} or {{#foo:...}}.

Behavior switches

A behavior switch controls the layout or behavior of the page and can often be used to specify desired omissions and inclusions in the content.

Word Description
Table of contents
__NOTOC__ Hides the table of contents (TOC).
__FORCETOC__ Forces the table of contents to appear at its normal position (before the first header, overriding __NOTOC__).
__TOC__ Places a table of contents at the word's current position overriding __NOTOC__. If this is used multiple times, the table of contents will appear at the first word's position.
__NOEDITSECTION__ Hides the section edit links beside headings.
__NEWSECTIONLINK__ Adds a link beside the "edit" tab for adding a new section on a non-talk page.
__NONEWSECTIONLINK__ Removes the link beside the "edit" tab on pages in talk namespaces.
__NOGALLERY__ Used on a category page, replaces thumbnails in the category view with normal links.


Variables return information about the current page, wiki, or date. There is a limit to the number of variables marked as "[expensive]" per page.

Date and time

The following variables labeled current return the current date and time in UTC.
The following variables labeled local return the current date and time in eastern time.

Due to MediaWiki and browser caching, these variables frequently show when the page was cached rather than the current time.

Variable Output Description
{{CURRENTYEAR}} 2019 Year
{{LOCALYEAR}} 2019
{{CURRENTMONTH}} 02 Month (zero-padded number)
{{CURRENTMONTH1}} 2 Month (unpadded number)
{{CURRENTMONTHNAME}} February Month (name)
{{CURRENTMONTHNAMEGEN}} February Month (genitive form)
{{CURRENTMONTHABBREV}} Feb Month (abbreviation)
{{CURRENTDAY}} 16 Day of the month (unpadded number)
{{CURRENTDAY2}} 16 Day of the month (zero-padded number)
{{LOCALDAY2}} 16
{{CURRENTDOW}} 6 Day of the week (unpadded number), 0 (for Sunday) through 6 (for Saturday)
{{CURRENTDAYNAME}} Saturday Day of the week (name)
{{CURRENTTIME}} 20:45 Time (24-hour HH:mm format)
{{LOCALTIME}} 15:45
{{CURRENTHOUR}} 20 Hour (24-hour zero-padded number)
{{CURRENTWEEK}} 7 Week (number)
{{CURRENTTIMESTAMP}} 20190216204506 YYYYMMDDHHmmss timestamp
{{LOCALTIMESTAMP}} 20190216154506

Technical metadata

Note: Revision variables return data about the latest edit to the current page, even if viewing an older version of the page.

Variable Output Description
{{PAGEID}} 183 Returns the page identifier.
{{DISPLAYTITLE:title}} Change the current page's title header. The value must be equivalent to the default title: only capitalization changes to certain parts of the title and replacing spaces with underscores are allowed.


Variable Output Description
{{NUMBEROFPAGES}} 115 Number of wiki pages.
{{NUMBEROFARTICLES}} 66 Number of pages in namespace.
{{NUMBEROFFILES}} 2 Number of uploaded files.
{{NUMBEROFEDITS}} 519 Number of wiki edits.
{{NUMBEROFUSERS}} 14 Number of registered users.
{{NUMBEROFADMINS}} 3 Number of users in the sysop group.
{{NUMBEROFACTIVEUSERS}} 0 Number of active users, based on the criteria used in Special:Statistics.




[ Expensive] Number of pages (including subcategories and files) in the given category. (Category:Help used for demonstration)




[ Expensive]

Respectively, the number of

  • all pages
  • ordinary pages (excluding subcategories and files)
  • subcategories or
  • files

in the given category. (Category:Help used for demonstration)


Variable Output Description
{{NAMESPACE}} Help Name of the page's namespace
{{NAMESPACENUMBER}} 12 ID of the page's namespace
Name of the associated content namespace
{{TALKSPACE}} Help talk Name of the associated talk namespace


Variable Output Description
{{!}} | Used to include a pipe character as content in a table cell.

Parser functions

Parser functions are very similar to variables but take one or more parameters (technically, any magic word that takes a parameter is a parser function).

URL data

Parser function Input → Output Description
{{fullurl: page name}} {{fullurl:Main_Page}}
A protocol-relative path to the title. Note: Unbracketed protocol-relative links are not automatically linked.
{{filepath: file name}}
{{filepath:file name|nowiki}}
{{filepath:file name|thumbnail_size}}



A protocol-relative path to the full size or thumbnail of a media file.