Community Central
Community Central

A magic word is a keyword or phrase recognized by MediaWiki software (on which Fandom is built), which triggers the software to do something special on the page.

An example of magic word input and rendering

Instructions

It's generally best to add and edit magic words using source editor.

To add a magic word, simply add the magic word to the content of the page somewhere. It will look like code in the editor, but after you save or preview, it will display as intended.

In the editor

In the VisualEditor, magic words that affect the page content will show as templates. When editing in the source editor, magic words will show up highlighted (either in red or gray).

Typing the first curly brace will bring up a modal to "Add a template", which can be slightly confusing. Once the magic word is entered, and the Add template tab is clicked, there is an error message saying that "The "Template:<magic word>" template doesn't yet exist." but using the Insert tab in the upper right corner of the modal will result in the magic word being added and it will function properly.

Common magic words

Here are some of the most commonly used magic words:

  • __NOTOC__ hides the table of contents on a page.
  • __TOC__ places the table of contents exactly where this is entered. It overrides the NOTOC switch.
  • __NOEDITSECTION__ hides the "edit" links beside all headings on the page. To hide the edit link beside a particular heading, specify the heading using an HTML tag such as <h2>heading</h2> rather than with the usual wiki equals-signs syntax ( == heading == ).
  • __NEWSECTIONLINK__ replaces the "Edit" button with "Add topic", for adding new sections on a non-talk page.
  • __NONEWSECTIONLINK__ replaces the "Add topic" button with "Edit", on talk namespaces.
  • __HIDDENCAT__ makes a category hidden.
  • {{CURRENTDAYNAME}} outputs the current day of the week.
  • {{NUMBEROFARTICLES}} outputs the number of articles on your community.
  • {{SITENAME}} outputs the name of the community.
  • {{PAGENAME}} outputs the name of the page the word is placed on.
  • {{FULLPAGENAME}} outputs the full name of the page, i.e. with the namespace prefix, of the page it is placed on.
  • __EXPECTUNUSEDCATEGORY__ removes the category from Special:UnusedCategories which is helpful for tracking categories which should not necessarily appear as "unused" even when they are empty.
  • {{NAMESPACENUMBER}} displays the ID (number) of the page's namespace.

Full list of magic words

For a full list of available[1] magic words, see the magic words help page on MediaWiki.

Notes

  1. Some magic words may function differently, or not work, at Fandom. This occurs because the version of the MediaWiki software used by Fandom is not always the same version as those of either MediaWiki.org or Wikipedia.
  • {{SUBJECTPAGENAME}} and {{TALKPAGENAME}} (similarly {{SUBJECTPAGENAMEE}} and {{TALKPAGENAMEE}}) may not always act inversely. For example:
    {{TALKPAGENAME:User:Example}} → User talk:Example
    {{SUBJECTPAGENAME:Message Wall:Example}} → Message Wall:Example
    {{SUBJECTPAGENAME:User Talk:Example}} → User:Example

See also

Further help and feedback