...
Light module structure
Below you see the structure of an exemplary light module. Example of light module structure:
Code Block |
---|
magnolia.resources.dir/
└── <module-name>/
├── apps/
├── dialogs/
│ └── myDialog.yaml
├── module.yaml
├── webresources/
└── templates/
├── components/
│ ├── myComponent.ftl
│ └── myComponent.yaml
└── pages/
├── myTemplatemyPage.ftl
├── myPage.js
└── myTemplatemyPage.yaml
|
Light modules can contain more or less fewer folders compared to this example.
...
Light modules folder: magnolia.resources.dir
...
Magnolia light modules
...
Please note that a Magnolia Light module must reside within the so called "magnolia Magnolia resources directory", the ; this directory is also often is referred to as the the Magnolia light modules folder. The name and the location of this directory are arbitrary - , but you have provide must provide the path to the folder via configuration.
Include Page |
---|
| _What is magnolia.resources.dir |
---|
| _What is magnolia.resources.dir |
---|
|
Magnolia 5.6.1+: 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 .*/(templates|webresources|i18n)/.*
.
What items can be defined in a light module?
The following items all can be defined within a light module with YAML:using YAML. Items defined by YAML can be decorated, or can be reused with YAML inherit and include.
Multiexcerpt include |
---|
MultiExcerptName | bullet-point-list |
---|
PageWithExcerpt | _list of definition items with registries which can be done with YAML |
---|
|
Other non YAML-based items which can be in a light module:
- i18n message bundles (see Internationalization and related pages)
- JavaScript Models
Creating a light module with Magnolia CLI
With Magnolia CLI you can create the complete structure a single command. (If you want to install CLI, see - Installation.)Open a shell, change to you the light modules folder and run the following command:
Code Block |
---|
mgnl create-light-module my-module |
| | _Creating a light module with Magnolia CLI |
---|
|
Instead of my-module
use an appropriate name (no special characters such as space or german umlaut).