How to share content between pages?
Last modified by Lucas Charpentier (Sereza7) on 2024/11/28
There are several options to share content in several wiki pages (i.e. if the content is changed in a single place it's updated automatically in all other places where it's used).
Some options:
- Create a page holding the shared content and use the Display Macro or the Include Macro wherever you wish to include that content. This is the simplest and recommended way.
- Create an XClass/XObject and reference an XProperty from that XObject anywhere you wish to display the shared content. This is also a recommended way.
- See the XWiki Data Model
- See the FAQ tutorial
- Create a Wiki Macro and use that macro everywhere you wish to include the shared content.
- Edit the macros.vm file located on the file system and create a new Velocity macro in it. Then use that macro inside the Velocity Macro wherever you wish to include the shared content.
- Edit the layoutExtraVars.vm file located on the file system (or create a custom Skin to override it) and add a velocity variable in it that contains the content to share. Then use the Velocity Macro and reference that variable wherever you wish to display the shared content.