Help:Magic words

From Fanon Wiki
Revision as of 19:47, 10 November 2022 by PinkYoshiFan (talk | contribs) (Apparently we don't have the disambig extension installed, not sure if anyone else cares about it. I ended up pretty much merging variables and parser functions here due to being fairly similar in invocation.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Logo mono black.png
This is one of Fanon Wiki's help pages and is meant to aid users by improving their ability to positively contribute to the wiki. Expanding pages such as this with additional information is always welcome.
Logo mono black.png

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

Construction.png
This page is under construction.
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:
  • PAGES returns all pages
  • ARTICLES returns content pages
  • FILES returns files
  • EDITS returns edit count
  • USERS returns registered user count
  • ADMINS returns number of administrators
  • ACTIVEUSERS returns list of people who did something in the last 30 days
{{xPAGENAME}} Returns the name of the current page, containing the parts x
  • Blank returns the full name without the namespace
  • FULL returns the full name including the namespace
  • BASE returns the page that it is a subpage of
  • ROOT returns the root page that the page is a subpage of
  • SUB returns the subpage name without any of the preceding part
  • ARTICLE or SUBJECT returns the non-talk version on a talk page
  • TALK returns the talk page of a non-talk page

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.