Documents Macro
Last modified by Vincent Massol on 2021/03/17 21:04
![]() | Displays list of documents in a Livetable |
Type | XAR |
Category | Macro |
Developed by | |
Rating | |
License | GNU Lesser General Public License 2.1 |
Bundled With | XWiki Standard |
Compatibility | Since XWiki 3.5M1 |
Table of contents
Description
Displays a list of documents in a Livetable.
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 .).
Example 1
Display all pages having Drafts. as part of their references.
{{documents location="Drafts."/}}
Results in:
Old Examples
Example 1
{{documents count="5" actions="false" space="Main" parent="Main.WebHome"/}}
Results in:
Example 2
If you wish to list all children documents of the current document:
{{velocity}}
{{documents parent="$doc.fullName"/}}
{{/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: