---
title: "Set up Content Serialization"
slug: "set-up-content-serialization"
abstract: "Guide to how to set up serialization functionality through installing a necessary plugin and configuring Content Serialization"
---
# Set up Content Serialization

In order to enable Sitecore Content Serialization, you must enable serialization commands by installing the Sitecore CLI Serialization Plugin and configure your project files.

## Serialization commands

To perform Content Serialization operations, you use a set of [serialization commands](https://doc.sitecore.com/sai/en/developers/sitecoreai/sitecore-command-line-interface/sitecore-cli-command-reference/the-cli-serialization-command.html "The CLI serialization command") and subcommands in the Sitecore CLI.

To use these commands, you must install the [Sitecore CLI Serialization Plugin](https://doc.sitecore.com/sai/en/developers/sitecoreai/sitecore-command-line-interface/plugins/serialization-plugin.html "Serialization plugin"), which extends the CLI by providing the `serialization` commands.

## Configure Content Serialization

Sitecore Content Serialization (SCS) is configured through project and module files that define which content items are included and which ones are excluded, as well as which operations 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 the module file, but you can [configure the relative serialization path](https://doc.sitecore.com/sai/en/developers/sitecoreai/sitecore-content-serialization/serialization-paths/change-the-relative-serialization-path.html "Change the relative serialization path") to any path you want.

Configuration happens at two levels, the project configuration file (`sitecore.json`) and the project's module files (such as `Project.module.json`):

### The project configuration file

The project configuration file is named `sitecore.json`. It has several properties, including a `modules` property that references the relevant [Sitecore Content Serialization modules](https://doc.sitecore.com/sai/en/developers/sitecoreai/sitecore-content-serialization/create-a-sitecore-content-serialization-module.html "Create a Sitecore Content Serialization module").

A project configuration in its simplest form looks like this:

```json
{
  "$schema": "./.sitecore/schemas/RootConfigurationFile.schema.json",
  "modules": [ "src/*/*.module.json" ]
}
```

### Including and excluding content items

You single out subsets of content items for serialization with *includes* and *rules*. This is useful for repeating the serialization of particular parts of your content item tree.

You configure what and how content items are included and excluded from serialization in a module file such as `Project.module.json`. You can place and *override* serialization configurations in all module files.

> [!note]
> A content item is only included once across all modules.

Each include must have a `name` property that becomes a folder name in your file system and a `path` property that specifies what part of your content item tree to serialize.

For example, to serialize your entire content item tree to the `serialization\content\` folder in your file system, add this to your `Project.module.json` file and run the `sitecore ser pull` command:

```
"items": {
  "includes": [
    {
      "name": "content",
      "path": "/sitecore/content/home"
    }
  ]
}
```
> [!important]
> The order of the includes is important. If your content items are dependent on a template in the same module, your template include must come first.

See [the Sitecore Content Serialization configuration reference](https://doc.sitecore.com/sai/en/developers/sitecoreai/sitecore-content-serialization/configuration/sitecore-content-serialization-configuration-reference.html "Sitecore Content Serialization configuration reference") for the complete list of include and rule properties.

> [!note]
> Include properties are referred to as *root* properties, as in *root name* and *root path*.

#### Rules

Rules are used to configure the serialization of content item trees. You 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.

For example, if you want to synchronize the `/sitecore/content/home/products/` path and all its descendants except those in the `legacy/` path, you add an include like the following:

```
"items": {
  "includes": [
    {
      "name": "content",
      "path": "/sitecore/content/home",
      "rules": [
        {
           "path": "/products/legacy",
           "scope": "ignored"
        },
        {
           "path": "/products",
           "scope": "ItemAndDescendants",
           "allowedPushOperations": "createUpdateAndDelete"
        },
        {
           "path": "\*",
           "scope": "ignored"
        }
      ]
    }
  ]
}
```

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 any more `/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.

Keep the following things in mind when you configure rules:

- Do not let rule paths overlap. Or, if you do, you must put the most specific rule first.
- Rules for parent's paths override rules for children's and descendants' paths.
- Rule scopes cannot be more inclusive than the root scope. For example, if the root scope is `ItemAndChildren`, the rule scope cannot be `ItemAndDescendants`.
- The `alias` property in a rule replaces the root `name` property (the folder name in your file system) for this particular rule.
- If you have configured an `alias` property *and* a `scope` property with an `ignored` value, the scope is used. Content items scoped to be ignored are not influenced by aliases.

See [the Sitecore Content Serialization configuration reference](https://doc.sitecore.com/sai/en/developers/sitecoreai/sitecore-content-serialization/configuration/sitecore-content-serialization-configuration-reference.html "Sitecore Content Serialization configuration reference") for all configurable rule properties.

### Excluding fields in an SCS package

> [!note]
> The excluded fields feature is available from CLI 4.0 or later.

You can [exclude fields from serialization](https://doc.sitecore.com/sai/en/developers/sitecoreai/sitecore-content-serialization/configuration/excluded-fields.html "Excluded fields") by specifying them in the `sitecore.json` config file and any `*modules.json file` .

> [!note]
> Sync operations always ignore excluded fields. So if you change those fields in Sitecore, the CLI does not detect any changes, and pushing data does not override them. If you have excluded fields in YAML files, they are removed only after changes in the included fields or if you manually delete that exclusion and perform a `pull` operation.

The `excludedFields` property contains an array of the excluded fields with two properties: `fieldId` and `description`.

You can also configure excluded fields for the CLI commands `package`, `watch`, and `diff`.
