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.
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 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:
- Imaging variations
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 bundle based on the empty webapp. Add a dependency to the Site module in your webapp pom file.
Enterprise Edition Pro provides the multisite feature. It allows you to configure a different site definition for each website in a single Magnolia instance. Each site can be mapped to a different domain and you can serve content from different workspaces. These features are in the Multisite module.
- Community Edition allows one site definition
- Enterprise Edition Standard allows one site definition
- Enterprise Edition Pro allows unlimited site definitions
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.
Template availability defines which page templates are available to editors in the Pages app. There are more ways to control page template availability.
optional , default is
Enables and disables the site definition.
Maps domain names to the site. Requires the Multisite module (EE Pro).
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, Enterprise Edition Standard)
config:/modules/multisite/config/sitesin a multisite setup (Enterprise Edition Pro)
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
I add a site definition as described here, under a <site> name, like travel. But where do I define what site definition should be used? In the site definition the `fallback` content node is used to specify which site definition should be used by "default" but where would I define it otherwise so that is doesn't use a fallback definition but to configure a given site's configuration for... pages I guess. Thanks for bearing with me.
When using Magnolia CE, you can have only one site definition.
With Magnolia EE Pro which comes with the Multisite module you can configure several site definitions.
The site definition to use is determined per request - this is done by the multisite filter (see MultiSiteFilter).
If you have more than one site definition, you should configure
domains- that's where you define under which constraints which site def. is used.
Read How to use Multisite, and there especially
The fallback comes into play, if the multisite filter can not properly assign a site def. (e.g. because the mappings and domains are ambiguous or not properly defined).
But the fallback really should be fallback, not "default".
I hope this helps,
So on the site definition level with CE only one (the first?) content node will be considered to be the site definition, without further configurations, right?
You also can use the Site app.