Tuesday, July 27, 2021

Layer Configuration

ØSitecore divides configuration files into layers.

ØEach layer consists of a dedicated folder under the App_config folder.

Ø By default, there are four layers:

²Sitecore

²Modules

²Custom

²Environment

Layer file path C:\inetpub\wwwroot\ScSample.dev.local\App_Config

The load order of configuration files

By default, Sitecore loads its configuration files in this order:

ØBasic system files, such as layers.config, ConnectionStrings.config, and web.config.

ØConfiguration files in the Sitecore layer.

ØConfiguration files in the Modules layer.

ØConfiguration files in the Custom layer.

ØConfiguration files in the Environment layer.

ØWithin each layer, by default, Sitecore goes through all the subfolders in the layer recursively and loads the files in each subfolder in alphabetical order.

Control the load order of configuration files

ØIn the /App_config/layers.config file, add a <loadOrder> setting to the layer's definition:

 <layer name="Custom" includeFolder="/App_Config/Custom/">

<loadOrder>

</loadOrder>

</layer>

 

ØAdd the file folders or individual files inside the <loadOrder> section in the order you want them to load:

 <loadOrder>

<add path="Folder23" type="Folder" />

<add path="Folder9/sitespecific.config" type="File" />

<add path="Folder1" type="Folder" />

</loadOrder>

Disable a patch file

Disable a single patch file


ØNavigate to the patch file in the file system, and rename it to end in something other than .config. For example, rename Sitecore.Analytics.Config to Sitecore.Analytics.Config.Disabled.

ØAdd the patch file to a <loadOrder> section and add the mode="Off" attribute. For example: <add path="Sitecore.Analytics.Config" type="File" mode="Off" />

Disable all patch files in a layer

ØOpen the Website/App_Config/layers.config file.

ØLocate the relevant layer definition string, for example, the Environment layer.

ØAdd the mode="off" attribute to the layer definition. For example, to disable all the configuration files in the Environment layer:

<layer name="Environment" includefolder="/App_config/Environment/" mode="off">

----------

</layer>

Now, when Sitecore loads, it ignores all configuration files in the layer.


No comments:

Post a Comment

Steps to follow when using a PowerShell script to modify the goals in Sitecore

I have previously utilized PowerShell for item creation, modification, deletion, and presentation details in Sitecore.   Ø Recently, I attem...