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 can be anywhere but it must be a real directory such as:
- Mac OS X
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.
When creating a name for a module, do not use spaces, accented characters such as
ü or special characters such as slashes
\ and so on. The name must match the regular expression
Create a light module with the Magnolia CLI
Using the Magnolia CLI you can create the folder structure for a light module with the command
create-light-module. Open a shell,
cd to your light modules directory, and execute the following command:
ü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.
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.
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.
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
To change the directory from which resources are loaded:
Stop Magnolia. Go to the
magnolia-x.y/apache-tomcat-x.y/bindirectory and type:
magnolia-x.y/apache-tomcat-x.y/webapps/magnoliaAuthor/WEB-INF/config/default/magnolia.propertiesfile and set the
<$myDir>with the actual path to your module folder.
Example on Windows. Note forward slashes!
Save the file.
Next: Creating a page template