Using MediaWiki Variables

< MediaWiki Project < Topic:MediaWiki templates

Variables provide useful information about the MediaWiki software that can be used alone or in combinations with other MediaWiki features. Templates use variables for example to adopt to changes in page names or to adopt to changes in the current time, rather than using static text.

Page variables

edit

Some variables are available which can be used to gain information about a page. They are:

Variable Example Explanation
{{NAMESPACE}} The current page's namespace. For the main namespace there is no name.
{{PAGENAME}} Using MediaWiki Variables The current page's name, including all levels (Title/Subtitle), without the namespace name.
{{BASEPAGENAME}} Using MediaWiki Variables The parent page's name, in namespaces supporting subpages ("Title/Other" for "Title/Other/Subtitle").
{{BASEPAGENAMEE}} Using_MediaWiki_Variables Similar to {{BASEPAGENAME}}, but replaces spaces with underscores.
{{SUBPAGENAME}} Using MediaWiki Variables The current subpage name in namespaces supporting subpages ("Subtitle" for "Title/Other/Subtitle").
{{SUBPAGENAMEE}} Using_MediaWiki_Variables Similar to {{SUBPAGENAME}}, but replaces spaces with underscores.
{{FULLPAGENAME}} Using MediaWiki Variables The current page's name. Similar to {{NAMESPACE}}:{{PAGENAME}}
{{TALKSPACE}} Talk The namespace of the current page's talk page.
{{TALKPAGENAME}} Talk:Using MediaWiki Variables The current page's talk page. Similar to {{TALKSPACE}}:{{PAGENAME}}
{{SUBJECTSPACE}}
{{ARTICLESPACE}}

The namespace of the current page's article or subject page.
{{SUBJECTPAGENAME}}
{{ARTICLEPAGENAME}}
Using MediaWiki Variables
Using MediaWiki Variables
The current page's article or subject page.
Similar to {{SUBJECTSPACE}}:{{PAGENAME}} or {{ARTICLESPACE}}:{{PAGENAME}}
Variable Example Explanation
{{REVISIONID}} - The revision id (revid) of the last edit made
{{REVISIONDAY}}
{{REVISIONDAY2}}
25
25
The day the last edit was made (01 through 31, with and without 0 padding).
{{REVISIONMONTH}} 02 The month the last edit was made (1 through 12)
{{REVISIONYEAR}} 2018 The year the last edit was made
{{REVISIONTIMESTAMP}} 20180225153007 Timestamp of the last edit made
{{PAGESIZE:page name}} 5,108 Size in bytes of the specified page.
Variable Example Explanation
{{NAMESPACE:page name}} Help Namespace of the specified page
{{PAGENAME:page name}} Example/Test Name of the specified page without the namespace name.
{{BASEPAGENAME:page name}} Example Parent page of the specified page, in namespaces supporting subpages
{{SUBPAGENAME:page name}} Test Subpage name of the specified page, in namespaces supporting subpages
{{FULLPAGENAME:page name}} Help:Example/Test Page name of the specified page, including namespace
{{TALKSPACE:page name}} Help talk Talk namespace for the specified page
{{TALKPAGENAME:page name}} Help talk:Example/Test Talk page for the specified page
{{SUBJECTSPACE:page name}}
{{ARTICLESPACE:page name}}
Help
Help
Article or subject namespace for the specified page
{{SUBJECTPAGENAME:page name}}
{{ARTICLEPAGENAME:page name}}
Help:Example/Test
Help:Example/Test
Article or subject page for the specified page

References

edit