Magnolia 5.7 reached extended end of life on May 31, 2022. Support for this branch is limited, see End-of-life policy. Please note that to cover the extra maintenance effort, this EEoL period is a paid extension in the life of the branch. Customers who opt for the extended maintenance will need a new license key to run future versions of Magnolia 5.7. If you have any questions or to subscribe to the extended maintenance, please get in touch with your local contact at Magnolia.
Light modules can be built with a simple text editor, with no special tools (such as Maven) required. A light module cannot incorporate java classes.
Light module structure
Example of light module structure:
magnolia.resources.dir/ └── foo/ ├── apps ├── blocks ├── contentTypes ├── decorations ├── dialogs │ ├── components │ └── pages ├── i18n │ └── foo-messages_en.properties ├── includes │ └── README.txt ├── messageViews ├── README.md ├── restEndpoints ├── templates │ ├── components │ └── pages ├── themes ├── virtualUriMappings └── webresources
(This example structure was created using version 3.1.0 of Magnolia CLI and setting
comprehensive as the value of the
-P flag of the
create-light-module CLI command.)
Light modules folder:
Magnolia light modules must reside within the Magnolia resources directory; this directory is also often referred to as the Magnolia light modules folder. The name and the location of this directory are arbitrary, but you must provide the path to the folder via configuration.
magnolia.resources.diris a property defining the directory from which resources are loaded in a Magnolia instance. This directory is used for file-based resources such as light modules and for overriding classpath resources. The property is configured in
WEB-INF/config/default/magnolia.propertiesand has the default value
$magnolia.home/modules. To see the current value of the property, go to the Config Info tab in the About Magnolia app.
You can use symbolic links (a.k.a symlinks or soft links) in the resources directory to include light modules located elsewhere on your system.
Magnolia 5.6.1+: A change in the light modules folder may also flush the server cache. You can configure this behavior under
pattern property, which specifies the pattern for the operation. The default value is
What items can be defined in a light module?
The following items can be defined within a light module using YAML. Items defined by YAML can be decorated, or can be reused with YAML inherit and include.
- App definitions
- Dialog definitions
- Field type definitions
- Media editor definitions
- Message view definitions
- Renderer definitions
- REST endpoint definitions
- Template definitions
- Theme definitions
- Virtual URI mappings
- Workflow definitions
- Work item handler definitions
Other non YAML-based items which can be in a light module:
- i18n message bundles (see Internationalization and related pages)
Creating a light module with Magnolia CLI
create-light-module. Open a shell,
cdto your light modules directory, and execute the following command:
mgnl create-light-module one-pager-module
üor special characters (e.g. slashes
\and so on). The name must match the regular expression
Note that this only works if you have installed Magnolia CLI, see Magnolia CLI Installation.