Listing the most popular pages – MindTouch Community Portal
Listing the most popular pagesTable of contents
1. 1. Variation for 9.02 and later
1. 1.1. CodeThere is currently no built-in function for retrieving the most popular pages. However, there is an MindTouch API function which can be invoked from DekiScript!
For this sample, we use uri.build to build the URI from the site.api URi. Then, we use web.xml to fetch the document from it (see what the XML looks like). Now, we iterate over all elements in the document and print out foreach the link, title, and view count using xml.text.
DekiScript retrieves this information as the anonymous user (it does not pass on the context of the current user), so if your MindTouch is private, than this code snippet will return no pages.
view sourceprint?
12
- {{ web.link(uri.build(site.uri, “index.php", { title: xml.text(p, ‘path’) ?? “" }), xml.text(p, ‘title’)) }} ({{ num.format(xml.text(p, ‘metrics/metric.views’), ‘#,#00’) }} views)
3