Search code examples
groovyvelocityxwiki

Views / edits current page xWiki


Is there a way to publish the amount of views/edits of a page in/on the page itself in xWiki?

I've used parts of this article to create an accessible form to see usages of different spaces. But I would also like to publish the views/edits on the pages itself.

Thanks in advance!

Richard


Solution

  • I would suggest you use an UIExtension point (see https://extensions.xwiki.org/xwiki/bin/view/Extension/UIExtension%20Module and the tutorial https://www.xwiki.org/xwiki/bin/view/Documentation/DevGuide/Tutorials/UIXTutorial/) from the list of available ones (https://www.xwiki.org/xwiki/bin/view/Documentation/DevGuide/ExtensionPoint/) to add the extra information to be displayed on each page.

    I guess the most suitable UIXP would be the Content Footer one (https://www.xwiki.org/xwiki/bin/view/Documentation/DevGuide/ExtensionPoint/ContentFooterUIX/).

    Inside the UIX you add, you can do a simple query to fetch the view/edit values from the statistics module (either with the API, if it exists) or with a HQL query, like in the example you've mentioned.