Search code examples
mediawikimediawiki-templates

How to Create Local WikiText Variable in MediaWiki Template?


How to create a temporary local variable using wikitext, in a MediaWiki template?

Example:

MyVar = "Banana"

{{#if: {{{2}}}
|<small>MyVar</small>
|'''MyVar'''
}}

This extension ought to do the trick, but wondering if there's a native method.


Solution

  • According to MediaWiki's documentation on the matter, there are built-in variables in MediaWiki, such as {{CURRENTYEAR}}, and extensions like Variables that can create custom variables. However, there is no native way to define variables.