Skip to main content
MindTouch Success Center

Apply conditional global variables

Written by Damien Howley
Former MindTouch Employee at MindTouch
This page applies to:MindTouch (current)

This article demonstrates how to set up global variables to ease management of terms used throughout your site that may need updating at a future date.
 

What are global variables and how are they used?


Global variables are values that are defined in one central interface and are accessible throughout your entire collection of documentation. They are used in situations where you have a common term or name that is used frequently and may change over time.  

For example, you may have a global variable such as a Version Number for your product that is included in 1,000 different articles. When your company releases a new product version, you may be tasked with updating all 1,000 references to the version number. With a global variable, you will only have to update the version number in one place.  
 

How to set up and use your global variable


Step 1: Define the global variable

  1. Navigate to Site tool > Dashboard > Content management > Global variables.
  2. Open the Variables page in Edit mode.
  3. Define your global variable such as in the example below:
let export = {
    productname : "Mosarch",  
    productversion : "7.13"
};

Step 2: Use the global variable

  1. Open the page in which you want to use the global variable in Edit mode.
  2. Instead of the version number, type the defined variable inside of two curly brackets
Here is my regular text.  Here is my text about {{productname}}, specifically I am talking about
version {{productversion}}

 

Adding 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 as below:

let export = {

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

The last variable does NOT have a comma at the end.  

 

Limitations


  • 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.  
     
  • Was this article helpful?