Community Central
Community Central
mNo edit summary
(36 intermediate revisions by 14 users not shown)
Line 1: Line 1:
  +
[[File:Magic_Word_Example.png|thumb|Example of magic word input and rendering.|250px|right]]
A "'''magic word'''" is a symbol recognized by the MediaWiki software and which triggers the software to do something other than display that symbol.
 
  +
A "'''magic word'''" is a keyword or phrase recognized by MediaWiki software (which Wikia is built on), which triggers the software to do something special on the page. When editing in the visual editor, magic words on the page will show up as a green puzzle piece.
   
  +
==Step-by-Step==
Some of the most commonly used examples are listed below.
 
  +
*To add a magic word, simply add the magic word to the content of the page somewhere. It will look like code, but after you save (or preview), it will work as intended.
  +
**Magic words can be added in either editor (source or visual), however, source mode must be used to edit a magic word. Alternatively, in the visual editor, you can simply remove the magic word you wish to change and add the new one.
   
==Popular magic words==
+
==Common Magic Words==
  +
Here are some of the magic words used most commonly at Wikia:
===Behavior switches===
 
:'''''Examples:'''''
 
* <code><nowiki>__NOTOC__</nowiki></code> hides the table of contents on a page.
 
* <code><nowiki>__TOC__</nowiki></code> places the table of contents exactly where this is entered. It overrides the NOTOC switch.
 
   
 
* <code><nowiki>__NOTOC__</nowiki></code> hides the [[Help:Table of contents|table of contents]] on a page.
It is important to note that it is '''two''' underscores on either side, and that it '''must''' be all capitals. Most of the behavior switches that Wikia uses are standard (find them [[mw:Help:Magic words#Behavior_switches|here]]). Due to extensions, however, there are a few extra, such as <code><nowiki>__NOWYSIWYG__</nowiki></code>, which disables the [[Help:Rich text editor|rich text editor]].
 
 
* <code><nowiki>__TOC__</nowiki></code> places the table of contents exactly where this is entered. It overrides the NOTOC switch.
 
  +
* <code><nowiki>__NOWYSIWYG__</nowiki></code>, disables the [[Help:Rich text editor|rich text editor]] on a page.
===Variables===
 
 
* <code><nowiki>{{CURRENTDAYNAME}}</nowiki></code> produces the current day of the week.
 
* <code><nowiki>{{CURRENTDAYNAME}}</nowiki></code> produces the current day of the week.
 
* <code><nowiki>{{NUMBEROFARTICLES}}</nowiki></code> shows the number of articles on your wiki.
 
* <code><nowiki>{{NUMBEROFARTICLES}}</nowiki></code> shows the number of articles on your wiki.
 
* <code><nowiki>{{SITENAME}}</nowiki></code> produces the name of the wiki.
 
* <code><nowiki>{{SITENAME}}</nowiki></code> produces the name of the wiki.
  +
* <code><nowiki>{{PAGENAME}}</nowiki></code> produces the name of the page the word is placed on.
  +
* <code><nowiki>{{FULLPAGENAME}}</nowiki></code> produces the entire page name, i.e. along with the namespace, of the page it is placed on.
   
==Full list of variables==
+
==Full list of Magic Words==
  +
For a full list of available magic words, see the [[mw:Help:Magic words|Magic words help page]] on Media Wiki. <ref>Some magic words may function differently, or not work, at [[Special:Version|Wikia]]. This occurs because the version of the MediaWiki software used by Wikia is not always the same version as those of either [[mw:Special:Version|MediaWiki.org]] or [[wikipedia:Special:Version|Wikipedia.org]].</ref>
===Technical metadata===
 
  +
Revision variables return data about the '''latest edit to the current page''', even if viewing an older version of the page.
 
  +
==Wikia-Specific Magic Words==
{| {{prettytable}}
 
  +
Some extensions or features unique to Wikia also have magic words associated with them. Here is a comprehensive list:
|-
 
  +
! Variable
 
  +
===Wiki Navigation===
! Output
 
  +
These magic words will fill in data for your wiki navigation bar. To utilize them, these must be placed on the MediaWiki:Wiki-navigation page:
! Description
 
  +
! Versions
 
  +
* #categoryX# - where X is a number greater than 0. This gets the top 8 pages from the X biggest category on a wiki.
|-
 
  +
* #category-Foo# - Gets the top 8 pages from Category:Foo.
| colspan="4"| '''Site'''
 
  +
* #visited# - Populates a list of the top visited pages from [[MediaWiki:Most popular articles]].
|-
 
  +
* #newlychanged# - Gets recently edited pages.
| <tt><nowiki>{{SITENAME}}</nowiki></tt>
 
  +
* #topusers# - Gets a list of the most active users.
| {{SITENAME}}
 
  +
| The wiki's site name.
 
  +
===Category Galleries===
|
 
  +
These magic words will apply to the Category Gallery feature when left on a Category page:
|-
 
  +
| <tt><nowiki>{{SERVER}}</nowiki></tt>
 
  +
* <code><nowiki>__NOCATEGORYGALLERY__</nowiki></code> - Hides a category gallery from being rendered on a category page.
| {{SERVER}}
 
  +
* <code><nowiki>__FORCECATEGORYGALLERY__</nowiki></code> - If the category gallery is enabled on a wiki, but it is not applied to all categories by default, this will add a category gallery to the category page.
| domain URL
 
  +
|
 
  +
==Notes==
|-
 
  +
<references/>
| <tt><nowiki>{{SERVERNAME}}</nowiki></tt>
 
| {{SERVERNAME}}
 
| domain name
 
|
 
|-
 
| <tt><nowiki>{{DIRMARK}}</nowiki></tt><br /><tt><nowiki>{{DIRECTIONMARK}}</nowiki></tt>
 
| {{DIRMARK}}<br />{{DIRECTIONMARK}}
 
| Outputs a unicode-directional mark that matches the wiki's default language's direction (<code>&amp;lrm;</code> on left-to-right wikis, <code>&amp;rlm;</code> on right-to-left wikis), useful in text with multi-directional text.
 
| 1.7+
 
|-
 
| <tt><nowiki>{{SCRIPTPATH}}</nowiki></tt>
 
| {{SCRIPTPATH}}
 
| relative script path
 
|
 
|-
 
| <tt><nowiki>{{CURRENTVERSION}}</nowiki></tt>
 
| {{CURRENTVERSION}}
 
| The wiki's MediaWiki version.
 
| 1.7+
 
|-
 
| <tt><nowiki>{{CONTENTLANGUAGE}}</nowiki></tt><br /><tt><nowiki>{{CONTENTLANG}}</nowiki></tt>
 
| {{CONTENTLANGUAGE}}<br />{{CONTENTLANG}}
 
| The wiki's default interface language
 
| 1.7+
 
|-
 
| colspan="4"| '''Latest revision to current page'''
 
|-
 
| <tt><nowiki>{{REVISIONID}}</nowiki></tt>
 
| {{REVISIONID}}
 
| Unique revision ID
 
| 1.5+
 
|-
 
| <tt><nowiki>{{REVISIONDAY}}</nowiki></tt>
 
| {{REVISIONDAY}}
 
| Day edit was made (unpadded number)
 
| 1.8+
 
|-
 
| <tt><nowiki>{{REVISIONDAY2}}</nowiki></tt>
 
| {{REVISIONDAY2}}
 
| Day edit was made (zero-padded number)
 
| 1.8+
 
|-
 
| <tt><nowiki>{{REVISIONMONTH}}</nowiki></tt>
 
| {{REVISIONMONTH}}
 
| Month edit was made (unpadded number)
 
| 1.8+
 
|-
 
| <tt><nowiki>{{REVISIONYEAR}}</nowiki></tt>
 
| {{REVISIONYEAR}}
 
| Year edit was made
 
| 1.8+
 
|-
 
| <tt><nowiki>{{REVISIONTIMESTAMP}}</nowiki></tt>
 
| {{REVISIONTIMESTAMP}}
 
| Timestamp as of time of edit
 
| 1.8+<!--
 
|-
 
| <tt><nowiki>{{REVISIONUSER}}</nowiki></tt>
 
| {{REVISIONUSER}}
 
| The username of the user who made the most recent edit to the page
 
| [[rev:48149|1.15+]]-->
 
|-style="background:#FED;"
 
| <tt><nowiki>{{PAGESIZE:</nowiki>''page name''<nowiki>}}</nowiki></tt>
 
| {{PAGESIZE:Help:Magic_words}}
 
| '''[expensive]''' Returns the byte size of the specified page.
 
|
 
|-<!--
 
| <tt><nowiki>{{PROTECTIONLEVEL:</nowiki>''action''<nowiki>}}</nowiki></tt>
 
| protection level
 
| Outputs the protection level (e.g. 'autoconfirm', 'sysop') for a given action (e.g. 'edit', 'move') on the current page or an empty string if not protected.
 
| [[rev:45587|1.15+]]-->
 
|-
 
| colspan="4"| '''Affects page content'''
 
|-
 
| <tt><nowiki>{{DISPLAYTITLE:</nowiki>''title''<nowiki>}}</nowiki></tt>
 
|
 
| Format the current page's title header. The value must be equivalent to the default title: only capitalization changes and replacing spaces with underscores.
 
| 1.7+
 
|-
 
| <tt><nowiki>{{DEFAULTSORT:</nowiki>''sortkey''<nowiki>}}</nowiki></tt><br /><tt><nowiki>{{DEFAULTSORTKEY:</nowiki>''sortkey''<nowiki>}}</nowiki></tt><br /><tt><nowiki>{{DEFAULTCATEGORYSORT:</nowiki>''sortkey''<nowiki>}}</nowiki></tt>
 
|
 
| Used for categorizing pages, sets a default [[Help:Categories|category sort key]]. For example if you put <tt><nowiki>{{DEFAULTSORT:Smith, John}}</nowiki></tt> at the end of a page called 'John Smith', the page would be sorted under "S" by default in categories.
 
| 1.10+
 
|}
 
===URL data===
 
{| {{prettytable}}
 
|-
 
! Parser function
 
! Input → Output
 
! Description
 
! Versions
 
|-
 
| <tt><nowiki>{{localurl:</nowiki>''page name''<nowiki>}}</nowiki></tt><br /><tt><nowiki>{{localurl:</nowiki>''page name''<nowiki>|</nowiki>''query string''<nowiki>}}</nowiki></tt>
 
| <nowiki>{{localurl:MediaWiki}}</nowiki> → {{localurl:MediaWiki}}<br /><nowiki>{{localurl:MediaWiki|printable=yes}}</nowiki> → {{localurl:MediaWiki|printable=yes}}
 
| The relative path to the title.
 
|
 
|-
 
| <tt><nowiki>{{fullurl:</nowiki>''page name''<nowiki>}}</nowiki></tt><br /><tt><nowiki>{{fullurl:</nowiki>''page name''<nowiki>|</nowiki>''query_string''<nowiki>}}</nowiki></tt><br /><tt><nowiki>{{fullurl:</nowiki>''interwiki:remote page name''<nowiki>|</nowiki>''query_string''<nowiki>}}</nowiki></tt>
 
| <nowiki>{{fullurl:Category:Top level}}</nowiki> → {{fullurl:Category:Top level}}<br />
 
<nowiki>{{fullurl:Category:Top level|action=edit}}</nowiki> → {{fullurl:Category:Top level|action=edit}}
 
| The absolute path to the title. This will also resolve [[Help:Interwiki link|interwiki]] prefixes.
 
| 1.5+
 
|-
 
| <tt><nowiki>{{filepath:</nowiki>''file name''<nowiki>}}</nowiki></tt><br /><tt><nowiki>{{filepath:file name|nowiki}}</nowiki></tt>
 
| <nowiki>{{filepath:Wiki.png}}</nowiki> → {{filepath:Wiki.png}}<br /><nowiki>{{filepath:Wiki.png|nowiki}}</nowiki> → {{filepath:Wiki.png|nowiki}}
 
| The absolute URL to a media file.
 
|
 
|-
 
| <tt><nowiki>{{urlencode:</nowiki>''string''<nowiki>}}</nowiki></tt>
 
| <nowiki>{{urlencode:x y z}}</nowiki> → {{urlencode:x y z}}
 
| The input encoded for use in URLs.
 
|
 
|-
 
| <tt><nowiki>{{anchorencode:</nowiki>''string''<nowiki>}}</nowiki></tt>
 
| <nowiki>{{anchorencode:x y z}}</nowiki> → {{anchorencode:x y z}}
 
| The input encoded for use in URL section anchors (after the '#' symbol in a URL).
 
|
 
|}
 
   
 
==See also==
 
==See also==
  +
*[[Help:Editing|Editing]]
*[[mw:Help:Magic words]] on MediaWiki.org — for a full list of available magic words.
 
  +
*[[MediaWikiWiki:Help:Extension:ParserFunctions|Parser Functions]]
*[[m:Help:Magic words]] on MetaWiki — for an additional full list of available magic words.
 
*[[wikipedia:Help:Magic words]] on Wikipedia — for still more on magic words.
 
   
  +
==Further help and feedback==
[[de:Hilfe:Zauberwörter]]
 
  +
{{Help and feedback section}}
[[es:Ayuda:Palabras mágicas]]
 
  +
[[fr:Aide:Mots magiques]]
 
 
[[Category:Editing]]
[[nl:Help:Magische woorden]]
 
 
[[Category:Help|{{PAGENAME}}]]
 
[[Category:Help|{{PAGENAME}}]]
  +
[[Category:Expand|{{PAGENAME}}]]
 
 
[[de:Hilfe:Zauberwörter]]
 
[[eshelp:Ayuda:Palabras mágicas]]
 
[[frhelp:Aide:Mots magiques]]
  +
[[ithelp:Aiuto:Parole magiche]]
 
[[nlhelp:Help:Magische woorden]]
  +
[[pl:Pomoc:Magic words]]
  +
[[ja:Help:マジックワード]]

Revision as of 23:36, 17 March 2014

File:Magic Word Example.png

Example of magic word input and rendering.

A "magic word" is a keyword or phrase recognized by MediaWiki software (which Wikia is built on), which triggers the software to do something special on the page. When editing in the visual editor, magic words on the page will show up as a green puzzle piece.

Step-by-Step

  • To add a magic word, simply add the magic word to the content of the page somewhere. It will look like code, but after you save (or preview), it will work as intended.
    • Magic words can be added in either editor (source or visual), however, source mode must be used to edit a magic word. Alternatively, in the visual editor, you can simply remove the magic word you wish to change and add the new one.

Common Magic Words

Here are some of the magic words used most commonly at Wikia:

  • __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.
  • __NOWYSIWYG__, disables the rich text editor on a page.
  • {{CURRENTDAYNAME}} produces the current day of the week.
  • {{NUMBEROFARTICLES}} shows the number of articles on your wiki.
  • {{SITENAME}} produces the name of the wiki.
  • {{PAGENAME}} produces the name of the page the word is placed on.
  • {{FULLPAGENAME}} produces the entire page name, i.e. along with the namespace, of the page it is placed on.

Full list of Magic Words

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

Wikia-Specific Magic Words

Some extensions or features unique to Wikia also have magic words associated with them. Here is a comprehensive list:

Wiki Navigation

These magic words will fill in data for your wiki navigation bar. To utilize them, these must be placed on the MediaWiki:Wiki-navigation page:

  • #categoryX# - where X is a number greater than 0. This gets the top 8 pages from the X biggest category on a wiki.
  • #category-Foo# - Gets the top 8 pages from Category:Foo.
  • #visited# - Populates a list of the top visited pages from MediaWiki:Most popular articles.
  • #newlychanged# - Gets recently edited pages.
  • #topusers# - Gets a list of the most active users.

Category Galleries

These magic words will apply to the Category Gallery feature when left on a Category page:

  • __NOCATEGORYGALLERY__ - Hides a category gallery from being rendered on a category page.
  • __FORCECATEGORYGALLERY__ - If the category gallery is enabled on a wiki, but it is not applied to all categories by default, this will add a category gallery to the category page.

Notes

  1. Some magic words may function differently, or not work, at Wikia. This occurs because the version of the MediaWiki software used by Wikia is not always the same version as those of either MediaWiki.org or Wikipedia.org.

See also

Further help and feedback