Listing the most popular pages

Listing the most popular pages – MindTouch Community Portal

Listing the most popular pages

Table of contents

1. 1. Variation for 9.02 and later
1. 1.1. Code

There 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?
1

    2
  • {{ 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

發表迴響

你的電子郵件位址並不會被公開。 必要欄位標記為 *

What is 14 + 14 ?
Please leave these two fields as-is:
IMPORTANT! To be able to proceed, you need to solve the following simple math (so we know that you are a human) :-)