Skip to main content
MindTouch Success Center

Set up global variables (MT4)

Global variables are beneficial to maintain consistency in your content for things like version numbers, product names, dependency information, etc.

Using global variables in MindTouch, you are able to define a variable and its value, add the variable reference to multiple pages in your content, update the variable in one location, and update all references automatically.

Set up global variables

  1. Navigate to your MindTouch site.
  2. Add the following to the end of your MindTouch domain: /Template:System/Variables  
    For example: If my site is, I'd go to
  3. Once there, you will see the following:


  4. This is the template where you will be able to manage the variables and their values

Add a variable and value

Edit the Variables template and remove the following from the page: // Use the 'export' value to define global variable.

In its place we'll add our first variable and value by adding the following:

 version:"Version 3.0"

This will make the block look like the following:

let export = {

    version:"Version 3.0"


In the above example, version is the variable name, and Version 3.0 is the value of the variable that will show when we use the variable.

Now we can save the page and you'll see the following:


Add a variable to an article

Now that we have set up our global variable and set a value for it, we can go to any MindTouch article and add it by putting double curly brackets around the variable name. In the example variable we set up above, the name of the variable is version, so we'd add the following to a MindTouch page:


Which will look like this in Edit mode:


When we save the article, we will see the following:



Note that on save the {{version}} was replaced with the value we set up in the Variables template. You can add this variable to multiple locations, and should you then need to update the value, you only need to change it in one place.  


Add multiple variables and values

You can add as many variables as you'd like by editing the Variables template and separating out the variables with commas like the following:

let export = {

    version:"Version 3.0",
    product:"Widgets Pro",
    browser:"Chrome 11"

Note that the last variable doesn't have a comma after it.  Once you've added all of your variables, then you can use them anywhere within your documentation.  


  • Variable names can include ASCII characters as well as "_" underscore and "$" dollar sign characters. However, a variable name cannot be solely comprised of an "_" underscore and "$" dollar sign character.
  • In addition, variables cannot start with an integer or number (e.g., 1Variable).
  • There are no character length limits for variable names or values.
  • Changing a DekiScript function as a global variable will break any DekiScript using that function on your site.  The same goes for any JavaScript functions that are used on your site.
    • For example if you set the following global variable all DekiScript with the map function would change to "test" and break:
let export = {
map: "test"


Set up global variables and custom classifications

If you would like to see what it looks like to set up global variables and custom classifications together, below is an example. 

let export = {
   // Use the 'export' value to define global variable.
   mtproduct:"MindTouch site",
   stag: "classification",
   stags: "classifications",
   stagup: "Classification",
   stagsup: "Classifications",
   // These terms represent common types of users in MindTouch, and are used throughout Overview sections in this site.
   techwriter: "Technical Writers",
   support: "Support Agents",
   sme: "Subject Matter Experts",
   manager: "Content Managers",
   admin: "Site Owners",
   enduser: "Consumers",
   developer: "Developers",
   ticketportalURL: "",
   ticket: "case",
   tickets: "cases",
   ds: {
       web : {
           pre : "web.pre(text) : xml.  Insert pre-formatted text."
       xml : {
           format : "xml.format(doc, style) : str.  Renders the XML document."
       uri : {
           build : ", path, args) : str.  Build a new URI with path and query parameters."
       site : {
           api : "site.api : str.  Returns a string with the site's API uri."

   helpurl: "",
   // Custom Classifications
   mindtouch: {
       customTagsDefinition: [
           prefix: 'complex',
           label: 'Complexity:',
           recursive: false,
           tags: [
               {tag: "beginner", label: "Beginner"},
               {tag: "intermediate", label: "Intermediate"},
               {tag: "advanced", label: "Advanced"}
           prefix: 'version',
           label: 'Version:',
           recursive: false,
           tags: [
               {tag: "tcs", label: "MindTouch TCS"},
               {tag: "mt4", label: "MindTouch 4"},
               {tag: "both", label: "TCS and MT4"}

What's Next

Make sure as you are adding variables that you take into consideration how the value of the variable fits within the context that you are adding it.  Pay special attention if there is any possessive intent within the context of the variable to ensure you have cohesive sentences/content.  

  • Was this article helpful?