Configure excluded fields
You can specify fields to exclude from serialization by configuring excluded fields in the sitecore.json and *modules.json files.
The excluded fields feature is available from CLI 4.0 or later.
Configuring excluded fields is also possible for the CLI commands package, watch, and diff.
The excludedFields property contains an array of the excluded fields with two properties: fieldId and description.
Sync operations always ignore excluded fields. 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.
If you exclude all the fields and your .yml file has empty versions without any fields data, when you then include those items in the .dat package and attach them to your instance items, the result is missing versions in the Content Editor.
Excluding Revision fields from serialization can result in issues when publishing with the serialization command.
The following fields are always excluded from signature generation and serialization operations by default: Owner, Revision, Updated, UpdatedBy, and Lock. Changes to these fields in Sitecore will not trigger a serialization operation. To push changes for items where only these fields have changed, you must also make a change to another (non-excluded) field to create serialization noise. This behavior should be considered when planning updates or troubleshooting why certain changes are not serialized.
Set up excluded fields in the sitecore.json file
You can specify fields to exclude from serialization in the sitecore.json file.
To set up excluded fields in the sitecore.json file:
-
Modify the
serializationsection of thesitecore.jsonfile, for example:RequestResponse... "serialization": { "defaultMaxRelativeItemPathLength": 120, "defaultModuleRelativeSerializationPath": "serialization", "excludedFields": [ { "fieldId": "badd9cf9-53e0-4d0c-bcc0-2d784c282f6a", "description": "__Updated by" }, { "fieldId": "d9cf14b1-fa16-4ba6-9288-e8a174d4d522", "description": "__Updated" }, { "fieldId": "5dd74568-4d4b-44c1-b513-0af5f4cda34f", "description": "__Created by" }, { "fieldId": "25bed78c-4957-4165-998a-ca1b52f67497", "description": "__Created" }, { "fieldId": "{52807595-0F8F-4B20-8D2A-CB71D28C6103}", "description": "__Owner" }, { "fieldId": "{001DD393-96C5-490B-924A-B0F25CD9EFD8}", "description": "__Lock" } ] }NoteSpecify base fields, for example, fields from the standard template that you do not want to sync. They are taken into account during serialization independently of particular module configurations.
Set up excluded fields in the modules.json file
You can specify fields to exclude from serialization in the modules.json file.
To set up excluded fields in the *modules.json file:
-
Modify the
itemssection of the*module.jsonfile, for example:RequestResponse... items": { "includes": [ { "name": "Apikey", "path": "/sitecore/system/Settings/Services/API Keys" }, { "name": "Media", "path": "/sitecore/media library/my-first-jss-app" }, { "name": "Templates", "path": "/sitecore/Templates/Project/my-first-jss-app" }, { "name": "Content", "path": "/sitecore/content/my-first-jss-app" }, { "name": "Layout", "path": "/sitecore/Layout/Layouts/Project/my-first-jss-app" }, { "name": "Renderings", "path": "/sitecore/Layout/Renderings/Project/my-first-jss-app" }, { "name": "Placeholders", "path": "/sitecore/Layout/Placeholder Settings/Project/my-first-jss-app" } ], "excludedFields":[ { "fieldID": "{EB504D1B-B612-4FFF-B239-CA3BD7273D1B}", "description": "FieldsForExclude1" }, { "fieldID": "{3C2C061E-F61F-4DF6-89EA-0B7A56348737}", "description": "FieldsForExclude2" }, { "fieldID": "{4F7446A4-79C8-4853-A357-723665FE68DA}", "description": "ExcludeUnversionFIeld" } ] }NoteSpecify only fields from this particular module config file.
Check excluded fields
After excluding fields from serialization using one of the methods described previously, you can use the serialization info command to either see a summary or full details about the fields you excluded.
To check the summary of configured excluded fields:
-
Run the
serialization infocommand. Output:RequestResponseProject Subtrees: Apikey: /sitecore/system/Settings/Services/API Keys Media: /sitecore/media library/my-first-jss-app Templates: /sitecore/Templates/Project/my-first-jss-app Content: /sitecore/content/my-first-jss-app Layout: /sitecore/Layout/Layouts/Project/my-first-jss-app Renderings: /sitecore/Layout/Renderings/Project/my-first-jss-app Placeholders: /sitecore/Layout/Placeholder Settings/Project/my-first-jss-app FieldsFilter Excludes: 3 Excluded Fields From Default Serialization Config: FieldsFilter Excludes: 7
To check the full details of the configured excluded fields:
-
Run the
serialization info -tcommand. Output:RequestResponseMaximum subtree-relative item path allowed: 120 Project File: C:\Repos\Sitecore.DevEx\samples\Prototype\items/Project.module.json Subtrees: ... Excluded Fields: Field Id :{EB504D1B-B612-4FFF-B239-CA3BD7273D1B}: Description :FieldsForExclude1. Field Id :{3C2C061E-F61F-4DF6-89EA-0B7A56348737}: Description :FieldsForExclude2. Field Id :{4F7446A4-79C8-4853-A357-723665FE68DA}: Description :ExcludeUnversionFIeld. Excluded Fields From Default Serialization Config: Excluded Fields: Field Id :8cdc337e-a112-42fb-bbb4-4143751e123f: Description :__Revision. Field Id :badd9cf9-53e0-4d0c-bcc0-2d784c282f6a: Description :__Updated by. Field Id :d9cf14b1-fa16-4ba6-9288-e8a174d4d522: Description :__Updated. Field Id :5dd74568-4d4b-44c1-b513-0af5f4cda34f: Description :__Created by. Field Id :25bed78c-4957-4165-998a-ca1b52f67497: Description :__Created. Field Id :{52807595-0F8F-4B20-8D2A-CB71D28C6103}: Description :__Owner. Field Id :{001DD393-96C5-490B-924A-B0F25CD9EFD8}: Description :__Lock.