Help:Magic words
From Fanon Wiki
|
Magic words are functions in MediaWiki that either modify the page and are called with double underscores on each side (officially referred to as "behavior switches") and things that return information and are called similarly to templates (officially referred to as "variables", ones that can take parameters can also be called "parser functions"). This is a list of helpful magic words and descriptions. Functions marked as expensive use more server resources and should not be used unless neccesary.
Behavior switches
Name | Effect |
---|---|
__NOTOC__
|
Makes the table of contents disappear |
__FORCETOC__
|
Overrides and undoes __NOTOC__
|
__TOC__
|
Makes the table of contents appear in a different location |
__NOEDITSECTION__
|
Makes a page section not be editable without editing the whole page |
__NOGALLERY__
|
Makes files appear as normal links in categories |
__HIDDENCAT__
|
Makes a category hidden and not appear to users unless they change a setting in their user preferences |
__EXPECTUNUSEDCATEGORY__
|
Makes a category not appear unused. Should only be used on maintenance categories. |
__NOINDEX__
|
Hides the page from search engine results |
Variables and parser functions
Reason: Add parser functions from the extension. |
All time-related variables use UTC.
Base MediaWiki variables and parser functions | |
---|---|
Name | Returns |
{{CURRENTYEAR}}
|
Year as numerals |
{{CURRENTMONTH}}
|
Month as numerals with leading zeroes added (adding 1 to the end removes the leading zeroes, adding NAME to the end makes it the name, adding ABBREV makes it the name abbreviation) |
{{CURRENTDAY}}
|
Day of the month (adding 2 to the end adds leading zeroes) |
{{CURRENTDOW}}/{{CURRENTDAYNAME}}
|
Number/name of the day of the week |
{{CURRENTTIME}}
|
24-hour time as HH:mm |
{{CURRENTHOUR}}
|
Hour with leading zeroes |
{{CURRENTWEEK}}
|
Current week of the year |
{{CURRENTTIMESTAMP}}
|
Timestamp as YYYYMMDDHHmmss |
{{SITENAME}}
|
Name of the wiki |
{{NUMBEROFx}}
|
Number of x on the wiki:
|
{{xPAGENAME}}
|
Returns the name of the current page, containing the parts x
This is not affected by DISPLAYTITLE |
{{NAMESPACE}}
|
The namespace of the page. Adding NUMBER to the end makes it the id. |
{{!}}
|
The pipe character |, for table markup within templates. |
{{PAGESINCATEGORY:name|modifier}}
|
EXPENSIVE. Returns the number of pages in the category name . modifier can be set to all, pages, subcats (subcategories), or files.
|
{{DISPLAYTITLE:name}}
|
Makes the page title display as something different than the page URL. |
{{localurl:name|query}}
|
Returns the url path (not including domain name, replace local with full for domain name and interwiki support and replace it with canonical to include https:) of a page on the wiki. query can be set to a query that can be performed in the url (such as action=edit
|
{{ns:name/id}}
|
The name of the namespace specified in name/id
|
{{lc:text}}
|
text in all lowercase
|
{{uc:text}}
|
text in all uppercase
|
Full list
For other magic words that may not be listed here for various reasons, see the mediawiki.org documentation.