Active development of JAMWiki has ceased, and bug fixes and support will be limited at best. If you are interested in taking over management of JAMWiki please send an email to the jamwiki-devel mailing list.

Help:Magic words

ktip.png This documentation of JAMWiki functionality is based on Mediawiki's reference at mediawiki:Help:Magic words. Original content licensed in the public domain.

Magic words are strings of text that JAMWiki associates with a return value or function, such as time, site details, or page names. The documentation below captures all magic words implemented in the Mediawiki syntax; those not yet implemented by JAMWiki are highlighted in red.

There are three general types of magic words:

Page-dependent magic words will affect or return data about the current page (by default), even if the word is added through a transcluded template or included system message.


Behavior switches

A behavior switch controls the layout or behaviour of the page and can often be used to specify desired omissions and inclusions in the content.

Word Description Versions
Table of contents
__NOTOC__ Hides the table of contents (TOC). 0.0.1+
__FORCETOC__ Forces the table of content to appear at its normal position (above the first header). 0.5.0+
__TOC__ Places a table of contents at the word's current position (overriding __NOTOC__). If this is used multiple times, the table of contents will appear at the first word's position. 0.0.4+
__NOEDITSECTION__ Hides the section edit links beside headings. 0.9.0+
__NEWSECTIONLINK__ Adds a link ("+" by default) beside the "edit" tab for adding a new section on a non-talk page (see Adding a section to the end). N/A
__NONEWSECTIONLINK__ Removes the link beside the "edit" tab on pages in talk namespaces. N/A
__NOGALLERY__ Used on a category page, replaces thumbnails in the category view with normal links. N/A
__HIDDENCAT__ Used on a category page, hides the category from the lists of categories in its members and parent categories (there is an option in the user preferences to show them). N/A
Language conversion
On wikis with language variants, don't perform any content language conversion (character and phase) in article display; for example, only show Chinese (zh) instead of variants like zh_cn, zh_tw, zh_sg, or zh_hk. N/A
On wikis with language variants, don't perform language conversion on the title (all other content is converted). N/A
__START__ No effect. N/A
__END__ Explicitly marks the end of the article, to prevent MediaWiki from removing trailing whitespace. Removed in 19213. N/A
__INDEX__ Tell search engines to index the page (overrides $wgArticleRobotPolicies, but not robots.txt). N/A
__NOINDEX__ Tell search engines not to index the page (ie, do not list in search engines' results). N/A
__STATICREDIRECT__ On redirect pages, don't allow MediaWiki to automatically update the link when someone moves a page and checks "Update any redirects that point to the original title". N/A


Variables return information about the current page, wiki, or date. Their syntax is similar to templates.

If a template name conflicts with a variable, the variable will be used (so to transclude the template Template:PAGENAME you would need to write {{Template:PAGENAME}}). In some cases, adding parameters will force the parser to invoke a template; for example, {{CURRENTDAYNAME|x}} transcludes Template:CURRENTDAYNAME, not the variable.

Date and time

The following variables return the current date and time in UTC.

Due to JAMWiki and browser caching, these variables frequently show when the page was cached rather than the current time.

The date and time magic words are formatted in the wiki content language.

Variable Output Description Versions
{{CURRENTYEAR}} 2018 Year 0.4.0+
{{CURRENTMONTH}} 02 Month (zero-padded number) 0.4.0+
{{CURRENTMONTHNAME}} February Month (name) 0.4.0+
{{CURRENTMONTHABBREV}} Feb Month (abbreviation) 0.4.0+
{{CURRENTDAY}} 24 Day of the month (unpadded number) 0.4.0+
{{CURRENTDAY2}} 24 Day of the month (zero-padded number) 0.4.0+
{{CURRENTDOW}} 4 Day of the week (unpadded number) 0.4.0+
{{CURRENTDAYNAME}} Saturday Day of the week (name) 0.4.0+
{{CURRENTTIME}} 11:58 Time (24-hour HH:mm format) 0.4.0+
{{CURRENTHOUR}} 11 Hour (24-hour zero-padded number) 0.4.0+
{{CURRENTWEEK}} 8 Week (number) 0.4.0+
{{CURRENTTIMESTAMP}} 20180224115818 YYYYMMDDHHmmss timestamp 0.4.0+

The following variables do the same as the above, but using the site's local timezone instead of user preferences and UTC:

  • {{LOCALDAY}}
  • {{LOCALDAY2}}
  • {{LOCALDOW}}

Technical metadata

Note: Revision variables return data about the latest edit to the current page, even if viewing an older version of the page.

Variable Output Description Versions
{{SITENAME}} JAMWiki Java Wiki Engine The wiki's site name. 0.9.0+
{{SERVER}} domain URL 0.7.0+
{{SERVERNAME}} domain name 0.7.0+
Outputs a unicode-directional mark that matches the wiki's default language's direction (‎ on left-to-right wikis, ‏ on right-to-left wikis), useful in text with multi-directional text. N/A
{{SCRIPTPATH}} Template:SCRIPTPATH relative script path ($wgScriptPath) N/A
{{STYLEPATH}} Template:STYLEPATH relative style path ($wgStylePath) N/A
{{CURRENTVERSION}} 2.0.0 The wiki's JAMWiki version. 0.4.0+
The wiki's default interface language ($wgLanguageCode) N/A
Latest revision to current page
{{REVISIONID}} 18093 Unique revision ID 0.9.0+
{{REVISIONDAY}} 7 Day edit was made (unpadded number) 0.4.0+
{{REVISIONDAY2}} 07 Day edit was made (zero-padded number) 0.4.0+
{{REVISIONMONTH}} 9 Month edit was made (zero-padded number as of JAMWiki 1.2, unpadded number in prior versions) 0.4.0+
{{REVISIONMONTH1}} 09 Month edit was made (unpadded number) 1.2+
{{REVISIONYEAR}} 2011 Year edit was made 0.4.0+
{{REVISIONTIMESTAMP}} 20110907022158 Timestamp as of time of edit 0.4.0+
{{REVISIONUSER}} wrh2 The username of the user who made the most recent edit to the page, or the current user when previewing an edit 0.9.0+
{{PAGESIZE:page name}}
{{PAGESIZE:page name|R}}
Template:PAGESIZE:Help:Magic words
Template:PAGESIZE:Help:Magic words
Returns the byte size of the specified page. Use "|R" to get raw numbers. N/A
{{PROTECTIONLEVEL:action}} protection level Outputs the protection level (e.g. 'autoconfirmed', 'sysop') for a given action (e.g. 'edit', 'move') on the current page or an empty string if not protected. N/A
Affects page content
{{DISPLAYTITLE:title}} Format the current page's title header. The value must be equivalent to the default title: only capitalization changes and replacing spaces with underscores. 0.9.1+
Used for categorizing pages, sets a default category sort key. For example if you put {{DEFAULTSORT:Smith, John}} at the end of John Smith, the page would be sorted under "S" by default in categories. N/A


Numbers returned by these variables normally contain separators (commas or spaces, depending on the local language), but can return raw numbers with the ":R" flag (for example, {{NUMBEROFPAGES}} → 1,044 and {{NUMBEROFPAGES:R}} → 1,044). Use "|R" for magic words that require a parameter like PAGESINCATEGORY (for example {{PAGESINCATEGORY:Help}} and {{PAGESINCATEGORY:Help|R}}). Also applicable to {{PAGESIZE:page name}} above.

The number magic words are formatted in the wiki content language.

Variable Output Description Versions
Entire wiki
{{NUMBEROFPAGES}} 1,044 Number of wiki pages. 0.4.0+
{{NUMBEROFARTICLES}} 151 Number of pages in content namespaces. 0.9.0+
{{NUMBEROFFILES}} 739 Number of uploaded files. 0.4.0+
{{NUMBEROFEDITS}} Template:NUMBEROFEDITS Number of page edits. N/A
{{NUMBEROFVIEWS}} Template:NUMBEROFVIEWS Number of page views. Usually useless on a wiki using caching. N/A
{{NUMBEROFUSERS}} 3,428 Number of registered users. 0.4.0+
{{NUMBEROFADMINS}} Template:NUMBEROFADMINS Number of users in the sysop group. N/A
{{NUMBEROFACTIVEUSERS}} Template:NUMBEROFACTIVEUSERS Number of active users, based on the criteria used in Special:Statistics. N/A
Number of pages in the given category. N/A
({{NUMBERINGROUP:bureaucrat}} used here)
Number of users in a specific group. N/A
not enabled Number of pages in the given namespace (replace index with the relevant namespace index). For instance, {{PAGESINNAMESPACE:14}} will output the number of category pages. {{PAGESINNS:0}} differs from {{NUMBEROFARTICLES}} in that the former includes redirects and disambiguation pages. Disabled by default, enable with $wgAllowSlowParserFunctions. N/A

Page names

Variable Output Description Versions
{{FULLPAGENAME}} Help:Magic words Namespace and page title. 0.4.0+
{{PAGENAME}} Magic words Page title. 0.4.0+
{{BASEPAGENAME}} Magic words Page title excluding the current subpage and namespace ("Title/foo" on "Title/foo/bar").

For more complex splitting, use {{#titleparts:}} from the parser functions.

{{SUBPAGENAME}} Magic words The subpage title ("foo" on "Title/foo"). 0.4.0+
{{SUBJECTPAGENAME}} Help:Magic words The namespace and title of the associated subject page. 0.4.0+
{{TALKPAGENAME}} Help comments:Magic words The namespace and title of the associated talk page. 0.4.0+

The {{BASEPAGENAME}} and {{SUBPAGENAME}} magic words only work in namespaces that have subpages enabled. See Manual:$wgNamespacesWithSubpages for information on enabling subpages.

The following are equivalents encoded for use in JAMWiki URLs (i.e. spaces replaced with underscores and some characters percent-encoded):


With JAMWiki 1.2+ (and Mediawiki 1.15+), these can all take a parameter, allowing specification of the page to be operated on, instead of just the current page:

  • {{PAGENAME:Template:Main Page}}Main Page
Warning Warning: Page titles containing certain characters, such as single quotes (') or asterisks *, may produce unexpected results when handled with these magic words, e.g. {{PAGESINCATEGORY:{{PAGENAME}}}}.

Note that {{PAGENAME}}, {{PAGENAMEE}} and {{urlencode:}} have distinct implementations. See Manual:PAGENAMEE encoding for details.


Variable Output Description Versions
{{NAMESPACE}} Help Name of the page's namespace 0.4.0+
Name of the associated content namespace 0.4.0+
{{TALKSPACE}} Help comments Name of the associated talk namespace 0.4.0+

The following are equivalents encoded for use in JAMWiki URLs (spaces replaced with underscores and some characters percent-encoded):


With JAMWiki 1.2+ (and Mediawiki 1.15+), these can take a page name parameter and will return the namespace of the page name parameter, instead of the current page's:

  • {{NAMESPACE:Template:Main Page}}Template
  • {{SUBJECTSPACE:Template:Main Page}}Template
  • {{TALKSPACE:Template:Main Page}}Template comments

Parser functions

Parser functions are very similar to variables, but take one or more parameters (technically, any magic word that takes a parameter is a parser function), and the name is sometimes prefixed with a hash to distinguish them from templates.

Additional parser functions are documented at Help:Parser Functions.

URL data

Parser function Input → Output Description Versions
{{localurl:page name}}
{{localurl:page name|query_string}}
{{localurl:MediaWiki}} → /wiki/en/MediaWiki
{{localurl:MediaWiki|printable=yes}} → /wiki/en/MediaWiki?printable=yes
The relative path to the title. 0.7.0+
{{fullurl:page name}}
{{fullurl:page name|query_string}}
{{fullurl:interwiki:remote page name|query_string}}
{{fullurl:Category:Top level}}

{{fullurl:Category:Top level|action=edit}}

The absolute path to the title. This will also resolve Interwiki prefixes. 0.7.0+
{{filepath:file name}}
{{filepath:file name|nowiki}}


The absolute URL to the full size or thumbnail of a media file. 0.7.0+
{{urlencode:string}} (or {{urlencode:string|QUERY}})
{{urlencode:x y z á é}} (or {{urlencode:x y z á é|QUERY}}) → x+y+z+%C3%A1+%C3%A9
{{urlencode:x y z á é|WIKI}} → x_y_z_%C3%A1_%C3%A9
{{urlencode:x y z á é|PATH}} → x%20y%20z%20%C3%A1%20%C3%A9

Note that the default changed from |WIKI to |QUERY in 1.17; this may break templates that rely on this function.

The input encoded for use in URLs. Note that there is no urldecode function. 0.7.0+
{{anchorencode:string}} {{anchorencode:x y z á é}} → x_y_z_%C3%A1_%C3%A9 The input encoded for use in URL section anchors (after the '#' symbol in a URL). 0.7.0+


{{ns:}} returns the current localized name for the namespace with that index, canonical name, or local alias. Thus {{ns:6}}, {{ns:File}}, and {{ns:Image}} (an old name for the File namespace) all return "Image". On a wiki where the content language was French, {{ns:Fichier}} would also be valid, but {{ns:Datei}} (the localisation of "File" into German) would not.

{{nse:}} is the equivalent encoded for JAMWiki URLs. It does the same, but it replaces spaces with underscores, making it usable in external links.

Content namespaces Talk namespaces
Usage Output Usage Output
{{ns:-2}} or {{ns:Media}} Media
{{ns:-1}} or {{ns:Special}} Special
{{ns:0}} or {{ns:}} {{ns:1}} or {{ns:Comments}} Comments
{{ns:2}} or {{ns:User}} User {{ns:3}} or {{ns:User comments}} User comments
{{ns:4}} or {{ns:Project}} Project {{ns:5}} or {{ns:Project comments}} Project comments
{{ns:6}} or {{ns:Image}} or {{ns:Image}} Image {{ns:7}} or {{ns:Image comments}} or {{ns:Image talk}} Image comments
{{ns:8}} or {{ns:JAMWiki}} JAMWiki {{ns:9}} or {{ns:JAMWiki comments}} JAMWiki comments
{{ns:10}} or {{ns:Template}} Template {{ns:11}} or {{ns:Template comments}} Template comments
{{ns:12}} or {{ns:Help}} Help {{ns:13}} or {{ns:Help comments}} Help comments
{{ns:14}} or {{ns:Category}} Category {{ns:15}} or {{ns:Category comments}} Category comments


Usage Input → Output Description Version
{{lc:string}} {{lc:DATA CENTER}} → data center The lowercase input. 0.7.0+
{{lcfirst:string}} {{lcfirst:DATA center}} → dATA center The input with the very first character lowercase. 0.7.0+
{{uc:string}} {{uc:text transform}} → TEXT TRANSFORM The uppercase input. 0.7.0+
{{ucfirst:string}} {{ucfirst:text TRANSFORM}} → Text TRANSFORM The input with the very first character uppercase. 0.7.0+
{{formatnum:unformatted num}}
{{formatnum:formatted num|R}}
The input with decimal and decimal group separators, and localized digit script, according to the wiki's default locale. The |R parameter can be used to unformat a number, for use in mathematical situations.
Warning Warning:Leading zeroes are not removed, you can use {{#expr:00001}} instead (see Help:Parser Functions)

{{#dateformat:date}} {{#formatdate:date}} {{#dateformat:date|format}} {{#formatdate:date|format}}

{{#dateformat:25 deC 2009|ymd}}
→ {{#dateformat:25 deC 2009|ymd}} (your pref), 2009 DeC 25 (default)
{{#formatdate:dec 25,2009|dmy}}
→ {{#formatdate:dec 25,2009|dmy}} (your pref), 25 Dec 2009 (default)
→ {{#dateformat:2009-12-25|mdy}} (your pref), December 25, 2009 (default)
{{#formatdate:2009 dec 25|ISO 8601}}
→ {{#formatdate:2009 dec 25|ISO 8601}} (your pref), 2009-12-25 (default)
{{#dateformat:25 decEmber|mdy}}
→ {{#dateformat:25 decEmber|mdy}} (your pref), DecEmber 25 (default)

Note: In the example above, "your pref" refers to your date preference on the current JAMWiki wiki only.

Formats an unlinked date based on user "Date format" preference, and adds metadata tagging it as a formatted date. For logged-out users and those who have not set a date format in their preferences, dates can be given a default: mdy, dmy, ymd, ISO 8601 (all case sensitive). If only the month and day are given, only mdy and dmy are valid. If a format is not specified or is invalid, the input format is used as a default. If the supplied date is not recognized as a valid date (specifically, if it contains any metadata such as from a nested use of these or similar templates), it is rendered unchanged, and no (additional) metadata is generated.
Warning Warning:Although the ISO 8601 standard requires that dates be in the Gregorian calendar, the ISO parameter in this function will still format dates that fall outside the usual Gregorian range (e.g. dates prior to 1583). Also, the magic word cannot properly convert between negative years (used with ISO 8601) and years BC or years BCE (used in general writing).
{{padleft:xyz|5}} → 00xyz
{{padleft:xyz|5|_}} → __xyz {{padleft:xyz|5|abc}} → abxyz {{padleft:xyz|2}} → xyz
{{padleft:|1|xyz}} → x (first character of the string)
Inserts a string of padding characters (character chosen in third parameter; default '0') of a specified length (second parameter) next to a chosen base character or variable (first parameter). The final digits or characters in the base replace the final characters in the padding; i.e. {{padleft:44|3|0}} produces 044. The padding string may be truncated if its length does not evenly divide the required number of characters. 1.2+
{{padright:xyz|5}} → xyz00

{{padright:xyz|5|_}} → xyz__ {{padright:xyz|5|abc}} → xyzab {{padright:xyz|2}} → xyz
{{padright:|1|xyz}} → x

Identical to padleft, but adds padding characters to the right side. 1.2+
{{plural:2|is|are}} {{plural:0|is|are}}Template:Plural:0
{{plural:21 mod 10|is|are}}Template:Plural:21 mod 10
{{plural:{{#expr:21 mod 10}}|is|are}}Template:Plural:1
(for Polish):
{{plural:2|milion|miliony|milionów}} → miliony
Outputs the singular form (second parameter) if the first parameter is an expression equalling one; the plural form (third parameter) otherwise. Plural transformations are used for languages like Russian based on "count mod 10". You should not expect this to handle fractions (like 44.5). N/A
{{grammar:N|noun}} Outputs the correct inflected form of the given word described by the inflection code after the colon (language-dependent). Grammar transformations are used for inflected languages like Polish. See also Manual:$wgGrammarForms. N/A


Usage Output Description Version
{{int:message name}} {{int:edit}}Template:Int:edit
(depends on user language, try: frja)
Internationalizes (translates) the given interface (JAMWiki namespace) message into the user language. Note that this can damage/confuse cache consistency. N/A
{{#language:language code}}

{{#language:language code|target language code}}

language code
language code
The full name of the language for the given language code: native name by default, name translated in target language if a target language code is specified. Codes are mostly in accordance with ISO 639. 1.1+
{{#special:special page name}}
{{#special:special page name}}
The localized name for the given canonical Special: page. N/A
(depends on parser tag) Alias for XML-style parser or extension tags, but parsing wiki code. Inner content can be passed as first parameter, and attributes as subsequent ones:

<tagname attribute1="value1" attribute2="value2"> content </tagname >{{#tag:tagname|content|attribute1=value1|attribute2=value2}}

Warning : You must write {{#tag:tagname||attribute1=value1|attribute2=value2}} to pass an empty content. No space is permitted between the | and the attribute name.

|return text if user is male
|return text if user is female
|return text if user hasn't defined their gender}}
(depends on the named user's gender) A switch for the gender set in Special:Preferences

Note: If 3rd parameter is omitted and user hasn't defined his/her gender, then text if user is male is returned.