Skip to main content
MindTouch Success Center

View recently modified pages

This page applies to:MindTouch (current)

The below method will lower customer effort by providing multiple access points that can be used to view the most recently modified articles on your site. By leveraging the MindTouch API and DekiScript, you will create a page that lists all of your site's most recently updated articles. You can then output the content of this page across all of your customer engagement channels.
 

Here's a way to achieve this through using MindTouch to create a recently modified pages document with Dekiscript, and then reading the page contents API for the rendered document. 
 

Build a collection of recently modified pages


Create a collection of DekiScript page objects that represent recently modified pages. There are different ways to build this collection depending on your needs:

// the top 10 most recently modified pages for the entire site
var pages = wiki.getpagestrendstats('', 10, true).recentlyupdated;

 OR

// top 20 most recently modified pages for a specific guide or category
var pages = wiki.getpagestrendstats('Documentation/Scripting', 20, true).recentlyupdated;

OR

// top 5 most recently modified pages for a specific page and its immediate subpages only
var pages = wiki.getpagestrendstats('Documentation', 5, false).recentlyupdated;

 

Create a recently modified pages document


Iterating over the collection of DekiScript page objects allows a developer to render page metadata in markup. Since you are fetching this content via an API, it does not need to necessarily be valid HTML.

<pages>
foreach(var page in pages) {
    <page id=(page.id)>
        <title>page.title</title>
        <path>page.path</path>
        <uri>page.uri</uri>
        <modified>page.date</modified>
        
        // ... more data is available in the page object. use only what you need however, fetching tags, properties, or
        // any other property whose value is preceded with $get_ will have to go back to a data source to fetch that
        // information. fetching more data than is absolutely necesssary will have adverse effects on this solution's
        // performance
    </page>
}
</pages>


Fetch the recently modified pages document


Wherever you ultimately place this code on your domain, grab the URL path ({scheme}://{domain}/{path}), double URL encode it, and use the page contents API to fetch it like so from your domain: {scheme}://{domain}/@api/deki/pages/={path}/contents?format=xhtml.

Without the format query parameter set, the content will be HTML entity encoded. Try the request with and without the format query parameter to determine which you prefer for consumption. With the format query parameter set to xhtml, the output of the above example looks like:

xhtml
 

Without the format query parameter set, the above example looks like:

entity


Example


DekiScript ObjectsSolutions/Product_Documentation/MindTouch_Tools_and_Features/DekiScript_Documentation/DekiScript_Objectshttps://success.mindtouch.com/Solutions/Product_Documentation/MindTouch_Tools_and_Features/DekiScript_Documentation/DekiScript_ObjectsTue, 14 Mar 2017 14:12:14 GMTDekiScript FunctionsSolutions/Product_Documentation/MindTouch_Tools_and_Features/DekiScript_Documentation/DekiScript_Functionshttps://success.mindtouch.com/Solutions/Product_Documentation/MindTouch_Tools_and_Features/DekiScript_Documentation/DekiScript_FunctionsTue, 14 Mar 2017 14:12:07 GMTUse DekiScriptSolutions/Product_Documentation/MindTouch_Tools_and_Features/DekiScript_Documentation/Use_DekiScripthttps://success.mindtouch.com/Solutions/Product_Documentation/MindTouch_Tools_and_Features/DekiScript_Documentation/Use_DekiScriptTue, 14 Mar 2017 14:11:33 GMT
  • Was this article helpful?