javascriptmacrostagsxwiki

How to display list of pages related to a tag in xwiki


I use xwiki to create a wiki. I want to dynamicaly display a list of pages (in a livetable or just bulk.), so I use the tag system.

Currently I use the HTML macro + iframe but it display all the page with header, side menus, options, etc.

I've tried this snippet but nothing is displaying and I don't really understand all the code, I'm not sure that is the good solution.

I've tried to use Display and Include macros :

{{display reference="Main.Tags"/}}

It display all my tags in a cloud.

But to had what I want I should specify this code with

queryString="do=viewTag&tag=Test"

Or something like that but I don't know how to do it.

So if you have an idea to display the list of pages with the same tag I will be happy to read it :)

Thanks.

EDIT1

So I work on it and I display what i want with the following instruction :

    {{velocity}}
#set ($list = $xwiki.tag.getDocumentsWithTag('test'))
#foreach($doc in $list)
  $doc
#end
{{/velocity}}

But the problem is that display all the path of the document.

    Wiki Interne.2\. Liste des flux TEST.2_1_Flux_Externes_Entrants.AGDAT01.WebHome
Wiki Interne.2\. Liste des flux TEST.2_1_Flux_Externes_Entrants.AGOL20.WebHome
Wiki Interne.2\. Liste des flux TEST.2_1_Flux_Externes_Entrants.AGOL21.WebHome
Wiki Interne.2\. Liste des flux TEST.2_1_Flux_Externes_Entrants.AGOL22.WebHome

How can I restrict the display only to the title of the document?


Solution

  • Thanks @Eduard Moraru :) I will try it.

    However I've resolved my case when I found the Velocity doc : http://velocity.apache.org/engine/1.7/user-guide.html

    The code for people who might be interested :

    {{velocity}}
    #set ($list = $xwiki.tag.getDocumentsWithTag('Your Tag'))
             #foreach($reference in $list)
      #set ($document = $xwiki.getDocument($reference))
      #set ($label = $document.getTitle())
             [[$label>>$reference]]
       #end
    {{/velocity}}