Container Macro

Last modified by Ramona Conoro on 2015/04/30 14:37

cogLays out wiki content
Developed by

XWiki Development Team

1 Votes
LicenseGNU Lesser General Public License 2.1
Bundled With

XWiki Enterprise, XWiki Enterprise Manager


XWiki Platform >= 2.5M2


For now, the only implemented decoration is the layout, and in particular the columns layout.


Use the container macro to define the layout and put the content to be layouted inside the container macro. For example, to layout content in columns, add a wiki group for each column inside the container macro, as in this example (for 2 columns).

{{container layoutStyle="columns"}}
(((first column)))
(((second column)))

Note that inside the column groups you can add any wiki content. For example, the following result can be achieved (a 2 columns layout, with wiki content in the columns):


Since XWiki 6.0, this macro is now responsive, which means that if there is not enough place to display the columns side by side, there are instead displayed one after the other in a vertical way. It improves the user experience.


Parameter definition

NameOptionalAllowed valuesDefault valueDescription
layoutStyleyesany string, only 'columns' is implemented by default, for time beingnoneThe layout to use for the content grouped by the container macro. If missing or a non-implemented value is passed, no layout is applied, the content of the container macro is just rendered as if the macro was not there.
justifyyesboolean (true/false)falseWhether the content in the container is justified or not (for the columns layout, it specify if the columns are be justified or not).

For developers

You can easily implement your own layout style to be used with the container macro, by implementing the LayoutManager interface as a component, and dropping your implementation in the classpath (WEB-INF/lib of your wiki installation). The hint of your component will be the name of the layout style to pass to the container macro.
For example:

public class GridLayoutManager implements LayoutManager

which can then be used in a wiki page by writing:

{{container layoutManager="grid"}}
your defined wiki content for the grid layout goes here

Get Connected