Magnolia 6.1 reached end of life on March 31, 2021. This branch is no longer supported, see End-of-life policy.
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.
Example of light module structure:
magnolia.resources.dir/ └── <module-name>/ ├── apps/ ├── contentTypes/ ├── dialogs/ │ └── myDialog.yaml ├── module.yaml ├── webresources/ └── templates/ ├── components/ │ ├── myComponent.ftl │ └── myComponent.yaml └── pages/ ├── myPage.ftl ├── myPage.js └── myPage.yaml
Light modules can contain more or fewer folders compared to this example.
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 its default value is
$magnolia.home/modules. To see the current value of the property, go to the Config Info tab in the About Magnolia app.
magnolia.resources.filesystem.observation.excludedDirectories property to exclude directories from being observed for changes. (See Configuration management - magnolia.resources.filesystem.observation.excludedDirectories.)
A change in the light modules folder may also flush the server cache. You can configure this behavior under
/modules/cache/config/contentCaching/defaultPageCache/flushPolicy/policies/lightModule/pathToCacheMappings/defaultPageCache with the
pattern property, which specifies the pattern for the operation. The default value is
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.
Other non YAML-based items which can be in a light module:
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.