Skip to main content
MindTouch Success Center

Global variables

A global variable is a dynamic placeholder that you can use in MindTouch content.

Change the value of variables in a central location to automatically change the output wherever variables are used.

  • Set {var1} = Hello so wherever "{var1}" exists in your content, it displays as "Hello" when the page loads.
  • Change the value to {var1} = Good Day to change the display to "Good Day" when the page loads.

Set up global variables

  1. Navigate to Site tool > Dashboard > Content management > Global variables.
  2. Select Edit from the MindTouch toolbar.
  3. Expand the DekiScript container to add variable names and output values.
  4. Save the page.
Single variable example
let export = {
    
    variablename:"Value"
};
Multiple variable example

Add a comma after each variable except the last variable should not have a comma at the end.

let export = {

    version:"3.0",
    product:"Widgets Pro",
    browser:"Chrome 11"
};
Optional comment example
let export = {

    //Descriptive comment
    version:"4.0"
};

Use global variables in content

  1. Open any page in Edit mode.
  2. When adding content, insert a variable using double curly brackets on each side of the variable name.
    This content is about {{productname}}, version {{productversion}}.
  3. Save the page to see the variable name display as the variable value.

When to use global variables

Global variables are useful for frequently used terms or snippets that may change over time.

  • Product or feature name -  A name that has not yet been approved or may change over time.
  • Version or build number - When you release a new version and some content is still relevant to the new version.
  • Copyright or expiration date - Update dates throughout content with one change.
  • Consistency - Product-related terminology, dependency information, author information, etc. will always display the same way.
  • Advanced dynamic content - Use global variables and custom classifications together or use conditional global variables.
  • DekiScript limitations - Consider global variable limitations.
  • Was this article helpful?