Skip to main content

View recently modified pages

This page applies to:MindTouch Responsive

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;


// 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.

foreach(var page in pages) {
    <page id=(>
        // ... 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

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:


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



Leverage the APIDocumentation/MindTouchResponsive/Scripting/Leverage_the_API, 27 Apr 2016 04:33:20 GMTScripting: FAQsDocumentation/MindTouchResponsive/Scripting/FAQs, 04 Feb 2016 03:52:32 GMTEnhance with global variablesDocumentation/MindTouchResponsive/Scripting/Enhance_with_global_variables, 04 Feb 2016 03:51:32 GMTEnhance with DekiScriptDocumentation/MindTouchResponsive/Scripting/Enhance_with_DekiScript, 04 Feb 2016 03:31:26 GMTScripting: Best PracticesDocumentation/MindTouchResponsive/Scripting/Best_practices, 04 Feb 2016 03:24:23 GMT
  • Was this article helpful?