Skip to main content

Multidomain

If several domains in one Contao installation should use the NATURE theme, this is possible with a few workarounds.

The goal of this guide is for each domain to have its own custom.scss, _custom_colors.scss and _custom_variables.scss. You should have at least NATURE theme version 1.11.0 (up to Contao 4.13) or 2.1.0 (Contao 5 and later) installed.

Note

As of Contao 4.12 the publicly accessible subfolder was renamed from /web to /public. If your installation has a /web directory, use web instead of public in the following code examples.

1) Create the SCSS files

Create a folder in the file manager under naturetheme/scss (e.g. domain2). Copy the files custom.scss, _custom_colors.scss and _custom_variables.scss into this folder.

In _custom_colors.scss, adjust the paths of the color schemes as follows.

​
//@import '../../../../public/bundles/contaothemesnetnaturetheme/scss/color_schemes/nature_red_colors';
//@import '../../../../public/bundles/contaothemesnetnaturetheme/scss/color_schemes/nature_blue_colors';
//@import '../../../../public/bundles/contaothemesnetnaturetheme/scss/color_schemes/nature_dark_colors';

/*
 * comment line to disable the ios dark mode
 */

//@import '../../../../public/bundles/contaothemesnetnaturetheme/scss/color_schemes/nature_dark_mode';
//@import 'color_schemes/nature_red_colors';
//@import 'color_schemes/nature_blue_colors';
//@import 'color_schemes/nature_dark_colors';

/*
 * comment line to disable the ios dark mode
 */

//@import 'color_schemes/nature_dark_mode';

In the same folder, also create a file nature.scss with the following content.

@import '../../../../public/bundles/contaothemesnetnaturetheme/scss/bulma/utilities/initial-variables';

@import '../../../../public/bundles/contaothemesnetnaturetheme/scss/fonts';

@import "_custom_colors";
@import "../../../../public/bundles/contaothemesnetnaturetheme/scss/nature_colors";

@import "_custom_variables";
@import "../../../../public/bundles/contaothemesnetnaturetheme/scss/nature_variables";

@import "../../../../public/bundles/contaothemesnetnaturetheme/scss/nature_style";

@import 'custom';

This is what it should look like in the end:

2) Create a template

Under Templates, create a new template fe_page_nature.html5 and rename it (e.g. fe_page_nature_domain2.html5).

Look for the following line and add the name of the domain (domain2 in this example) inside getCombinedStylesheet().

<link rel="stylesheet" type="text/css" media="all" href="<?= ContaoThemesNet\NatureThemeBundle\ThemeUtils::getCombinedStylesheet('domain2');

3) Create a layout

Go to Themes and Edit the page layouts of the theme (4th icon from the right) and duplicate any layout. Edit the layout and select the fe_page template you just created under Expert settings (at the very bottom) in Page template.

4) Assign the layout to the page

Finally, assign the layout to a page.