Do I need a site definition?
No, it is not necessary to use a site definition. A site based on concrete template definitions works perfectly well. A site definition is an advanced option. It is useful when you have a large site and want to avoid repeating a similar configuration.
Without a site definition you can still:
- Choose which templates are available to editors.
- Configure variations for each page template.
But without a site definition you cannot use:
You need the Site module in order to create a site definition. The Site module may not always be included, for example when you create your own webapp based on the empty webapp. Add a dependency to the Site module in your webapp pom file.
In DX Core, the number of sites that can be used is defined by the number of sites purchased.
In the Community Edition, you can only create and use one site.
Configuring a site definition
Configure a site definition in the Site app.
Example: Site definition for the Travel Demo site that ships with Magnolia (partial example).
Nodes and properties:
The template prototype is a master template definition which applies to the whole site. Anything you configure in the prototype is applied to all page templates.
optional, default is
Enables and disables the site definition.
Maps domain names to the site. Requires the Multisite module (DX Core).
Reference to a theme that defines the look and feel of the site. Themes are configured in
Locale configuration and support for entering and serving content in multiple languages.
When configuring the i18n node, make sure to provide the properties
required (when using i18n)
For instance use
|optional, default is |
URI mappings that define which node in a workspace should be served when a particular URI is requested.
Custom template properties that you can access from a script without having to write a class.
Variations adapt the site for different devices or geographical locations.
The Site app is actually a shortcut that displays the configuration from:
config:/modules/site/config/siteand from any extended locations in a single-site setup (Community Edition, DX Core)
config:/modules/multisite/config/sitesin a multisite setup (DX Core)
Choosing a fallback site definition
fallback is a special site definition that is used when no site matches the request. Think of it as a "default".
When you have multiple sites, configure one of them as a fallback. Use the
extends property to reference a complete site definition.
travel as a fallback site definition in