Skip to main content
MindTouch Success Center

Embed a tree navigation using DekiScript (wiki.tree)

This page applies to:MindTouch (current)

Understand how to use DekiScript to embed a dynamic tree navigation, including the ability to configure the beginning node.

DekiScript is a scripting language in MindTouch that can be used to add dynamic functionality to your articles. Examples include conditions (IF statements), top 10 lists, directories and more. For more information on DekiScript, see our DekiScript 101 guide.

Adding DekiScript to an Article

  1. Go to the article to which you want to add DekiScript.
  2. Make sure the editor is loaded; if it isn't, click Edit page.
  3. Go to the bottom of the page.
    • If the cursor only shows up in a DekiScript, CSS or JavaScript block, just push Shift + Enter to escape it. 
  4. In the editor, click the Insert menu.
  5. Select DekiScript.

  1. Once you have created the DekiScript block, you will need to paste the following DekiScript:

Use wiki.tree

The example above uses the wiki.tree() function, which displays a hierarchical tree of content that originates from the page which contains the wiki.tree() call. However, it can be customized further using the following parameters:

Name Type Description
path str (optional) wiki page path
depth num (optional) nesting depth for retrieving child pages (default: all)
reverse bool (optional) reverse order of child pages

Customize the path

By default, the wiki.tree() function will display a tree of content that originates from the page which contains the wiki.tree() call.  If you wish to alter the origin, you can enter a path to use instead of the original page.  The path is the part of the URL after the domain.  

For instance, if your page was your path would be /Documentation/Responsive/Analytics. To specify a path you can use the following DekiScript:


The following DekiScript accomplishes the same thing:

wiki.tree{path: '/Documentation/Responsive/Analytics'};

Customize the depth

By default, the wiki.tree() function will display every level of the heirarchy of content below the page which contains the wiki.tree call. In some cases, this can drastically deplete the performance of the page. By modifying the depth parameter, you can change the scope of the tree to include only a limited number of levels. 

For instance, if your complete hierarchy has 15 levels, but you only want to display the top two, you can set the depth to two. Use the following DekiScript to modify the depth:

wiki.tree('/Documentation/Responsive/Analytics', 2);

The following DekiScript accomplishes the same result as described above. However, it doesn't require that you enter a path:

wiki.tree{depth: 2};

Tip:  Because the depth parameter is a number, you do not need to wrap it in quotes.


wiki.tree{path: '/Documentation/Responsive/Analytics​'};


  • Was this article helpful?