Site module

Developer productivity Bundled: Community edition

Edition

CE

License

MLA, GPL

Issues

MGNLSITE

Git

Git

Maven site

Site

Latest

2.0.0

The Site module provides a site API. It allows you to create a site definition that contains configuration for a whole site such as navigation and common page areas.

Modules

Magnolia’s Site module reactor consists of the following submodules:

  • Site

  • Site Themes

  • Site JCR

Installing with Maven

Maven is the easiest way to install the module. Add the following to your bundle:

<dependency>
  <groupId>info.magnolia.site</groupId>
  <artifactId>magnolia-site</artifactId>
  <version>2.0.0</version>
</dependency>
<dependency>
  <groupId>info.magnolia.site</groupId>
  <artifactId>magnolia-site-themes</artifactId>
  <version>2.0.0</version>
</dependency>
<dependency>
  <groupId>info.magnolia.site</groupId>
  <artifactId>magnolia-site-jcr</artifactId>
  <version>2.0.0</version>
</dependency>

Configuration

You can configure a site using a YAML definition file in the sites folder of your module.

For an example site definition, see the travel.yaml definition file in the Magnolia demo-projects repository.

Property Description

templates

optional

     prototype

optional

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.

     availability

optional

Template availability defines which page templates are available to editors in the Pages app. There are more ways to control page template availability.

enabled

optional, default is true

Enables and disables the site definition.

domains

optional

Maps domain names to the site. Requires the Multisite module.

theme

optional

Reference to a theme that defines the look and feel of the site.

i18n

optional

Locale configuration and support for entering and serving content in multiple languages.

When configuring the i18n node, make sure to provide the properties class and enabled.

     class

required (when using i18n)

For instance use info.magnolia.cms.i18n.DefaultI18nContentSupport.

     enabled

optional, default is false

mappings

optional

URI mappings that define which node in a workspace should be served when a particular URI is requested.

trustedProxyConfig

optional

Configuration of a Trusted proxy headers filter for the given site.

travel
...
  trustedProxyConfig:
    forwardingEnabled: true
    headers:
      xForwardedFor:
        name: x_forwarded_for
        values:
          0: example.com
...

Incorrect filter configuration may block all user traffic.

If access to Magnolia is blocked by an incorrect filter configuration, you can fix this by decorating the site config and overriding the incorrect values.

Filter configuration parameters determine which headers are allowed or checked by this filter.

  • If forwardingEnabled is set to false (default), the filter blocks requests containing specific headers. This is to ensure security when proxy headers are not expected.

    The default setting prevents undesired traffic blocking.

  • If forwardingEnabled is set to true, the filter checks the values of specific headers in incoming requests. Requests with unexpected header values are blocked for security reasons.

Available header names:

  • x_forwarded_for for X-Forwarded-For

  • x_forwarded_host for X-Forwarded-Host

  • x_forwarded_proto for X-Forwarded-Proto

  • x_forwarded_port for X-Forwarded-Port

When using a proxy in front of Magnolia, it’s highly recommended to apply IP filtering in Tomcat so that only requests from the trusted proxy would be processed. For more details about setting IP filtering, see Remote Address Valve.

parameters

optional

Custom template properties that you can access from a script without having to write a class.

variations

optional

Variations adapt the site for different devices or geographical locations.

cors

optional

A CORS configuration for the site definition.

For configuration details, see the properties section on the Request processing and filters page.

Usage

For usage and an example configuration, see the Site definition page.

Feedback

DX Core

×

Location

This widget lets you know where you are on the docs site.

You are currently perusing through the Site module docs.

Main doc sections

DX Core Headless PaaS Legacy Cloud Incubator modules