Multi-Site Development

Follow best practices in multi-site development with C1 CMS

You should install and use the Composite.Tools.UrlConfiguration add-on. It allows you to map a hostname to a subsite within one Composite C1 installation, including its language-specific version.

  • For information about setting up hostnames for subsites, please see Hostnames.
  • For information about using the Composite.Tools.UrlConfiguration add-on, please see URL Configuration.

To limit access to a user to a specific subsite, you should set proper local permissions on this subsite:

  1. From the “Content” perspective, right-click the home page of the subsite.
  2. From the context menu, select “Edit Permissions”.
  3. On the “Users” tab, enable the user account you wish to control access for.
  4. Check / uncheck the corresponding permissions for the account.
  5. Click “Save”.

For example, for the read-only access, keep the “Read” permission checked only.

To limit access to a media folder:

  1. From the “Media” perspective, right-click the media folder.
  2. Repeat Steps 2-5 above.

Likewise, you can control access to a subsite and / or a media for a user group (the “User Groups” tab).

  • For more information about setting local permissions, please see Local Permissions.
  • For information about managing security in the C1 Console, please see Security.

To have individual sets of layout templates per subsite, you should make use of page types. Among other things, a page type allows you to associate specific layout templates with it and limit its child page types.

To create a page type:

  1. From the “Layout” perspective, select “Page Types”.
  2. Click “Add Page Type” on the tool bar.
  3. Enter a name and, optionally, some description for the page type.
  4. Click “OK”.

This will create a page type with defaults and open its view.

Next, select templates that will only be available for this page type:

  1. On the “Layout” tab, under “Layout restrictions”, check the layout templates you need.
  2. Optionally, you can select the default layout.
  3. Click “Save”.

Repeat the above steps for as many page types as you need.

You can also limit the availability of page types (and thus, layout templates associated with them) to specific parent page types. Only allowed child page types will be available when creating a page below a page based on a specific parent page type.

To limit the availability of page types to a parent page type:

  1. Edit a page type.
  2. On the “Availability” tab, under “Parent page type restriction”, check the parent page type(s) to limit this page type to.
  3. Click “Save”.

When created, each page is based on a specific page type, and when you add a new website (subsite) in the C1 Console, you basically create a home page of that website.

You can add page metadata (not inherited) to the home page of the subsite and, thus, control website specific settings.

To create a page metatype:

  1. From the “Data” perspective, select “Page Metatypes”.
  2. Click “Add Page Metatype” on the tool bar.
  3. Enter a title, type name and namespace.
  4. On the “Fields” tab, click “Add New” to add a field.
  5. Specify its name, label, select its field type and set other basic and advanced properties if needed.
  6. Repeat Step 5 for as many fields as you need.
  7. Click “Save”.

For example, you can create a metatype with a string field that allows specifying the name of the website (subsite).

To add the metadata field of the type you’ve just created to the home page of a website:

  1. From the “Content” perspective, right-click the home page.
  2. From the context menu, select “Add Metadata Field”.
  3. In the popup window, select the metatype and click “Next”.
  4. For the “Inherit display” parameter, select “Do not inherit” and click “Next”.
  5. Specify values in the fields where needed.
  6. Click “Finish”.

Now you can query for the specific website setting from the metadata on the website’s home page and control individual elements based on the value.

  • For information about creating metatypes and adding metadata fields, please see Page Meta Types.

You can boil a layout template down to a C1 Function which gets content HTML and emits the finished page. This enables you to put logic in place to control the layout generation, where you can react to host name, page meta data and the like.

You can also create individual layouts by using:

  • a site-specific class on the <html> element
  • site-specific stylesheets

You should install and use the Composite.Tools.SubsiteManager add-on. It allows a global administrator to create subsites and associated users. This enables 3rd-party subsite owners to maintain their own subsites, without having permissions to other subsites or global features.

Subsite owners will have full freedom in terms of content and page structure and be able to change any page content, select different layouts for pages, add C1 Functions to pages, and add and delete pages.

  • For information about installing and using the add-on, please see Subsite Manager.

Show Another Approach

You can join the meta data with the site structure, for instance, by using the SitemapNavigator class.

You can also adopt a naming pattern. When you attach meta data fields to page structures or page types, you get to name the field. You could use this in filtering logic.