Sitecore Content Serialization (SCS) is a system for serializing, sharing, and deploying content items, as well as keeping them in version control.
SCS is designed to help teams of developers that work on the same Sitecore solution to synchronize database changes between their individual development environments.
Sitecore Content Serialization comets with JSON based configurations in which we have certain options to configure while including and excluding the items.
Modes to Serialize
Combining the best of TDS and Unicorn, SCS give us the flexibility to move the content between environments. For this, we have two different tools mentioned below
- Sitecore CLI – A command line tool to interact with your Sitecore Instance.
- Sitecore for Visual Studio – A graphical tool to interact with Sitecore using Visual Studio.
Serialize content items in and out of a Sitecore instance using Sitecore Content Serialization (SCS) system. We need to configure which content items to include and which ones to exclude, and which operation to perform on the content items.
The SCS system serializes content items into your project folder as YAML files. The default path is \serialization relative to module files, but we can configure any path we want.
Project Configuration file
The project configuration file is name sitecore.json. It has several properties including a modules property, serialization property.
“modules”: [ “src/*/*.module.json” ],
Manual and automatic Serialization
We can use manual serialization when we want to push or pull content items to or from a Sitecore instance on demand.
We can use automatic serialization to specify content items that you would like to have automatically serialized from a Sitecore instance to our file system when they are created and updated.
Including and excluding content Items
We single out subsets of content items for serialization with includes and rules. This is useful for repeating serialization of particular parts of your content item tree.
We configure what and how content items are included and excluded from serialization in a module file such as Project.module.json
Rules are used to configure the serialization of content item tree. We configure rules with a path relative to the root path, the scope of content items to influence, and any alterations to the allowed push operations.
The rule system works by the first-match-wins principle, meaning that when a content item matches a rule, all subsequent rules are ignored:
- The first rule tells SCS to ignore all content items in the /sitecore/content/home/products/legacy path.
- The second rule tells SCS to serialize all content items in the /sitecore/content/home/products path. All subcontent items are included because the scope is ItemAndDescendants.
- The third rule prevents SCS from serializing anymore /sitecore/content/home content items. The wildcard path of this rule matches all content items not matched by the previous rules, and the ignored scope prevents them from being serialized.
Sitecore Content Serialization Setup
With Sitecore 10 release, lot of new feature available like Containers, ASP.NET Core Rendering, Serialization and etc.
- Visual Studio 2017/2019
- Sitecore 10 instance
- Sitecore CLI
- .NET Core 3.1
Install Sitecore CLI (Command line interface)
Before installing CLI, make sure you have installed 3.1 version of .NET Core because the “dotnet new-tool manifest” command is available only in .Net Core 3+ version.
Setup Visual Studio Solution
Create a new project in Visual Studio and make sure you follow the Helix Architecture and go to the project folder.
As stated above, the Sitecore Serialization installation and configuration process is very straightforward, and it doesn’t have to be a “pull/push everything at once” solution, as it may seem. You can make the changes much more targeted by specifying tags in your modules’ configuration files. If you feel this setup little tough to do it yourself, you can hire Sitecore consulting and support services to complete Sitecore Serialization installation and configuration setup.