Help:Magic words

From wiki.thepatternofeverything.org
Jump to: navigation, search

This is an organized 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.
__NOGALLERY__ [MW1.7+] This magic word allows images in category pages to be displayed as inline links instead of gallery.
__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).

Variables

For details see Help:Variable

Time

Word Example Explanation
{{CURRENTDAY}} 19 Displays the current day in numeric form.
{{CURRENTDAYNAME}} Friday Name of the day in the language of the project or English.
{{CURRENTDOW}} 5 Ditto as number (0=Sunday, 1=Monday...).
{{CURRENTMONTH}} 04 The number 01 .. 12 of the month.
{{CURRENTMONTHABBREV}} Apr [MW1.5+] Ditto abbreviated Jan .. Dec.
{{CURRENTMONTHNAME}} April Ditto in named form January .. December.
{{CURRENTTIME}} 23:37 The current time (00:00 .. 23:59).
{{CURRENTWEEK}} 16 Number of the current week (1-53) according to ISO 8601 with no leading zero.
{{CURRENTYEAR}} 2024 Returns the current year.


Statistics

Word Example Explanation
{{NUMBEROFARTICLES}} 1,582 A variable which returns the total number of articles on the Wiki.
{{NUMBEROFFILES}} 100 [MW1.5+] Returns the number of uploaded files (rows in the image table).


Page names and related info

Word Example Explanation
{{PAGENAME}} Magic words Returns the name of the current page, including all levels (Title/Subtitle).
{{PAGENAMEE}} Magic_words More URL-friendly percent encoded special characters (To use an articlename in an external link).
{{NAMESPACE}} Help Returns the name of the namespace the current page resides in.
{{REVISIONID}} 2139 [MW1.5+] The unique identifying number of a page, see Help:Diff.
{{SITENAME}} wiki.thepatternofeverything.org Web Site URL Name.
{{SERVER}} https://wiki.thepatternofeverything.org Web Site Address.
{{SCRIPTPATH}} [MW1.5+]
{{SERVERNAME}} wiki.thepatternofeverything.org [MW1.5+]


Colon functions

For details see Help:Colon function.


Namespaces and URLs

Word Example Explanation
{{ns:}} {{ns:4}} = wiki.thepatternofeverything.org
{{ns:project}} = wiki.thepatternofeverything.org
Returns the name of a given namespace number.
{{localurl:x y}}
{{localurle:%}}
{{localurl:x y}}
{{localurle:%}}
Returns the local URL of a given page. The page might not exist.

Formatting

Word Example Explanation
{{#language:}} {{#language:da}} = dansk [MW1.7+] Native name of language code.



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

Miscellaneous

Word Example Explanation
#redirect #REDIRECT [[target]]
at top of source page
Creates a redirect to another page.