Display Macro

Last modified by Eleni Cojocariu on 2026/08/27 14:40

cogDisplay an entity (document, property, etc.)
TypeJAR
CategoryMacro
Developed by

XWiki Development Team

Active Installs0
Rating
0 Votes
LicenseGNU Lesser General Public License 2.1
Bundled With

XWiki Standard

Compatibility

Introduced in XWiki 3.4M1

Success

Installable with the Extension Manager

Description

Display an entity in its own context. This mean that the entity content will be parsed and transformation executed on it as if it was rendered alone. For example a document will produce the exact same result as if you were displaying it directly.

It for examples allows to include a content page in the current page. To include an entity in the current context see include macro.

Usage

From WYSIWYG Editor

displayMacro-wysiwygEditor.png

From Wiki Syntax

{{display page="Page1/Page2"/}}

Parameters definition

NameOptionalAllowed valuesDefault valueDescription
page WarningHiddenno or referenceA page reference XWiki 10.11.2+  The reference of the page to display. XWiki 12.4+ This parameter is hidden by default, use reference instead.
reference no or pageAn entity reference The reference of the entity to display.
type WarningHiddenyesdocumentdocumentThe type of the entity. This parameter is only useful when used with the reference parameter. XWiki 12.4+ This parameter is hidden by default.
sectionyesstring The id to the Heading section to include in the target document. To do that you'll need to find out the id that is automatically generated by XWiki. To find it you have 2 solutions:
  • Compute it yourself by following this algorithm: "H" + heading title stripped of all non alpha characters. For example if your heading title is My Heading, the id will be HMyHeading.
  • View the HTML source of the page in your browser and find the id that was generated. For example, for a level 2 heading title of My Heading, the HTML will be <h2 id="HMyHeading" class="wikigeneratedid"><span>My Heading</span></h2>, and thus the id to use is the one from the id attribute, i.e. HMyHeading.

Note that in the future we plan to improve it.

excludeFirstHeadingyestrue or falsefalseXWiki 12.4+ If true, exclude the heading from the displayed page if the first element of that page is a heading.

Examples

Example 1:

{{display page="Page1/Page2" /}}

Example 2 (if you want to display a page from another wiki)

{{display page="somewiki:Page1/Page2" /}}

Example 3:

{{display page="Page1/Page2" section="HMySection" /}}

Example 4 (using the reference parameter):

{{display reference="Page1.Page2.WebHome" /}}

NOTE: Be sure to include the / within the "/}} at the end, otherwise any content that comes after the included section on this page will fail to appear.

Prerequisites & Installation Instructions

We recommend using the Extension Manager to install this extension (Make sure that the text "Installable with the Extension Manager" is displayed at the top right location on this page to know if this extension can be installed with the Extension Manager).

You can also use the manual method which involves dropping the JAR file and all its dependencies into the WEB-INF/lib folder and restarting XWiki.

Dependencies

Dependencies for this extension (org.xwiki.platform:xwiki-platform-display-macro 18.6.0):

Get Connected