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:
- From the “Content” perspective, right-click the home page of the subsite.
- From the context menu, select “Edit Permissions”.
- On the “Users” tab, enable the user account you wish to control access for.
- Check / uncheck the corresponding permissions for the account.
- Click “Save”.
For example, for the read-only access, keep the “Read” permission checked only.
To limit access to a media folder:
- From the “Media” perspective, right-click the media folder.
- 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:
- From the “Layout” perspective, select “Page Types”.
- Click “Add Page Type” on the tool bar.
- Enter a name and, optionally, some description for the page type.
- 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:
- On the “Layout” tab, under “Layout restrictions”, check the layout templates you need.
- Optionally, you can select the default layout.
- 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:
- Edit a page type.
- On the “Availability” tab, under “Parent page type restriction”, check the parent page type(s) to limit this page type to.
- 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.
- For more information about creating page types, please see Creating Page Types.
- For more information about associating layout templates with a page type, please see Restricting the Use of Templates.
- For more information about limiting page types by their “parents”, please see Limiting by Parent Page Types.
- For general information about page types, please see Page Types.
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:
- From the “Data” perspective, select “Page Metatypes”.
- Click “Add Page Metatype” on the tool bar.
- Enter a title, type name and namespace.
- On the “Fields” tab, click “Add New” to add a field.
- Specify its name, label, select its field type and set other basic and advanced properties if needed.
- Repeat Step 5 for as many fields as you need.
- 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:
- From the “Content” perspective, right-click the home page.
- From the context menu, select “Add Metadata Field”.
- In the popup window, select the metatype and click “Next”.
- For the “Inherit display” parameter, select “Do not inherit” and click “Next”.
- Specify values in the fields where needed.
- 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.
You can join the meta data with the site structure, for instance, by using the SitemapNavigator class.
- For information about querying meta data, please see How to Query Data Using LINQ.
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.