Skip to content
This repository has been archived by the owner on May 30, 2022. It is now read-only.

Site Configuration Management

David San Filippo edited this page Sep 11, 2017 · 1 revision

Site Configuration Management

In order to leverage many of these features, they need to be able to access Site specific configuration values. ASF does this by Creating a separate "Site Configuration" Item for every Site. If you choose to use the Information Architecture feature, there is a pre-built Branch Template for Creating Sites that include this item, but it is very easy to roll your own.

sc1.png

Although the above screenshot shows many sections of settings, it is important to note that the Site Configuration Template actually has no fields defined on it. It leverages template inheritance to import the templates needed to support the features that you want. This can be done on the content tab of the template.

sc2.png

Which template to use here is explained in the feature sections that follow, and sometime may also require a similar approach to page templates to ensure the proper fields are defined to support specific features.

Configuring Sites

Sites are connected to Site Configuration through an attribute "SF.SiteConfiguration" in the "Site" definition configuration. This configuration allows you to share Site configuration across multiple sites if desired, but is generally recommended to have a unique site configuration per site.

sc2.png

Note that features are coded such that Site Configuration is properly resolved in both published content and experience editor. The one area where this is sometimes an issue is in template standard values as they exist outside the site node and templates can be shared across sites.

Site App Settings

This core feature of ASF also has one additional sub-feature. You can store "Site Settings" item under your Site Configuration Item (The standard templates that come with ASF have this insert option pre-configured). A site setting is a string based key value pair similar to App Settings. They allow you to define additional configuration values easily if you don't want to create a full blown Site Settings Configuration Class.

sc4.png

By default Sitecore Foundation will look for any settings stored under the Site Configuration node, but you can override this behavior with an additional Site attribute “SF.ConfigRoot”

sc6.png

This enables you to have sites share configuration, or to maintain multiple Configurations for different environments and switch them with transforms during deployments.

To access their values, you can use the indexer on the Context through extension methods on the Sitecore Site Configuration.

sc7.png

Note that you’ll need to include a reference to “SF.Foundation.Configuration”.