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.
This page explains how to create and use a light module. The light module will host the files for the templates and other things.
Create a module folder
Create the following folder structure on your computer:
$myDir/ └── my-first-website-tutorial └── one-pager-module ├── dialogs │ ├── components │ └── pages ├── includes ├── templates │ ├── components │ └── pages └── webresources
$myDir
can be anywhere but it must be a real directory such as:
- Mac OS X
/Users/johndoe/magnolia
- Windows
C:\Users\johndoe\magnolia
We recommend that you create the files and folders by hand. You can download the one-pager-module
and its complete contents for reference. But be aware you get the final state of the files, like at end of the tutorial.
é
, à
, ç
, ä
, ö
, ü
or special characters such as slashes /
, \
and so on. The name must match the regular expression [a-zA-Z0-9-_]
.
Create a light module with the Magnolia CLI
create-light-module
. Open a shell, cd
to 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 [a-zA-Z0-9-_]
.Note that this only works if you have installed Magnolia CLI, see Magnolia CLI Installation.
Set magnolia.resources.dir
property
magnolia.resources.dir
is 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.properties
and 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. If you installed Magnolia using Magnolia CLI, the default for the magnolia.resources.dir
is the light-modules
directory created where you executed the jumpstart
command. This assumes you did not use the -p
option to specify another location for the light-modules
folder.
To change the directory from which resources are loaded:
Stop Magnolia. Go to the
magnolia-x.y/apache-tomcat-x.y/bin
directory and type:Mac OS X, Linux, Solaris./magnolia_control.sh stop
Windows./magnolia_control.bat stop
Edit the
magnolia-x.y/apache-tomcat-x.y/webapps/magnoliaAuthor/WEB-INF/config/default/magnolia.properties
file and set themagnolia.resources.dir
property. Replace<$myDir>
with the actual path to your module folder.magnolia.propertiesmagnolia.resources.dir=<$myDir>/my-first-website-tutorial/light-modules
Example on Windows.
Note forward slashes!
magnolia.propertiesmagnolia.resources.dir=C:/Users/johndoe/magnolia/my-first-website-tutorial/light-modules
Save the file.
Start Magnolia:
Mac OS X, Linux, Solaris./magnolia_control.sh start
Windows./magnolia_control.bat start
Next: Creating a page template