Documents Macro

Version 23.1 by Vincent Massol on 2021/03/17 17:53

cogDisplays list of documents in a Livetable
TypeXAR
CategoryMacro
Developed by

XWiki Development Team

Rating
0 Votes
LicenseGNU Lesser General Public License 2.1
Bundled With

XWiki Standard

Compatibility

Since XWiki 3.5M1

Description

Displays a list of documents in a Livetable.

This macro is part of the Index Application.

Usage

{{documents id="<id>" count="<count>" actions="<true|false>" space="<space>" parent="<parent>" columns="<columns>" location="<location>"/}}

where:

  • id (optional): The internal Livetable id (the HTML id). If not specified a random id is computed. This can be used for styling the Livetable for example.
  • count (optional): The number of items to display by default (defaults to 15)
  • actions (optional): Whether to show the actions columns or not if the user has the permissions (defaults to true)
  • space (optional, deprecated): If specified, only lists documents found in the passed space (by default all documents are listed). The full space reference must be passed. For example to list a document located in the Space1.Space2 space you'd need to use space="Space1.Space2 (simply using Space2 wouldn't work). Doesn't work with Nested Pages, use the location parameter instead.
  • parent (optional and deprecated): If specified, only list pages having the specified parent (by default all documents are listed). Doesn't work with Nested Pages, use the location parameter instead.
  • columns (optional): If specified, only display specified columns (e.g. doc.name,doc.author). The default value is doc.title,doc.location,doc.date,doc.author.
  • location (optional): If specified, only display documents having a part of their full reference matching the passed location. For example a location value of par would match a document with a reference of France.Paris.SomePage. Also note that the / character is accepted as a reference separator (in addition to .). New in 8.1M2

Example 1

 

Display all pages having Drafts. as part of their references.

{{documents location="Drafts."/}}

Results in:

documentsmacro-location.png

Old Examples

These examples are old examples dating back to when XWiki didn't have support for Nested Pages. They still work but won't handle pages nested at a level deeper than the first level.

Example 1

{{documents count="5" actions="false" space="Main" parent="Main.WebHome"/}}

Results in:

documentsmacro.png

Example 2

If you wish to list all children documents of the current document:

{{velocity}}
 {{documents parent="$doc.fullName"/}}
{{/velocity}}

Example 3

If you wish to have a single column displaying the document titles, you'd write:

{{documents count="5" actions="false" space="Main" parent="Main.WebHome" columns="doc.title"/}}

Results in:

documents-columns.png

Tags: livetable
    

Get Connected