Skip to main content

Implement basic dynamic controls

This page applies to:MindTouch Responsive

Use DekiScript to add dynamic controls to your site. Whether you want to generate a hierarchy outline, show a table of content, or add meta descriptions, this article lists some basic DekiScript functions to get you started. 

 

Generate a sitemap


A wiki.tree call is used to display a hierarchical view of the current page and all subpages. Add the following DekiScript block in its own paragraph:

{{wiki.tree();}}


The wiki.tree call also accepts a number of parameters that allow you to modify the output. The example above outputs a sitemap for the entire site. However, if you wanted to output just a section of your hierarchy, you could use the path parameter to confine your results.

{{wiki.tree{path: "/Documentation"};}}

View our wiki functions page for a list of all wiki.tree parameters.

 

Add a table of contents (TOC)


The wiki.toc call displays the headings on the current page in an outline format. To add a TOC to the current page, add the following DekiScript block:

{{wiki.toc();}}


 

Add an alphabetical site directory


The wiki.directory call shows all topics on your site sorted alphabetically. To add the directory to the current page, add the following DekiScript block:

{{wiki.directory();}}



Display the most recent author


The page.author call displays the name of the user who most recently edited the page. This call is great to showcase content creators and encourage other users to maintain content.  To display the most recent page author simply add the following DekiScript block to the page:

{{page.author.displayname;}}

 Example:   This page was edited by Lily M.

 

Apply meta description


The meta.description call allows authors to add a custom meta description tag to the page in the <head>element.  The meta description tag is used by search engines to determine a description or summary of your page. A meta description tag such as the one below may improve your search engine performance:

<meta name="description" content="This will often show up in search results.">


Since you cannot directly modify content in the <head> section of the HTML, modify your meta description simply by adding the following DekiScript blockto the page:

{{meta.description("This will often show up in search results");}}

For more information on <meta> tags, review our documentation on meta functions.

 

Apply meta keywords


The meta.description call allows authors to add a list of custom keywords as a <meta> tag in the HTML <head> section.  The meta keywords tag is used by search engines to determine important search keywords. A meta keywords tag such as the one below may improve your search engine performance:

<meta name="keywords" content="API,Documentation,DekiScript">


Since you cannot directly modify content in the <head> section of the HTML, modify your meta keywords simply by adding the following DekiScript block to the page:

{{meta.keywords("API, Documentation, DekiScript");}}

For more information on <meta> tags, review our documentation on meta functions.

 

What's next


Read about how to use dynamic controls to  reuse content