A while back we introduced a new version of Slices that include a repeatable and non-repeatable zone. If you are still using the old legacy style Slices and want to migrate to the newer Slices, this page will walk you though how.
You need to be careful with these kind of operations. We recommend to create a new custom type to migrate the content with the new Slice structure, and update your code so that it queries and displays the new JSON structure. This will avoid any impact in your live website.
We also recommend to use multiple environments for these kind of operations. Learn more about multiple environments.
By migrating to the new Slices syntax, administrators won't see the deprecated Slice warnings anymore in the custom type builder. Content editors and admins will be able to use the full capabilities of the new Slices:
- Ability to define an icon, title and description for each Slice
- Ability to save some Slices in your "Slice library" so you can reuse them on other custom types
- Ability to define fields into one the 2 zones of a Slice (Non-repeatable for a section title for instance; Repeatable for an iterative list of featured artists for instance.)
Prepare the migration
- In a new custom type, re- build the Slices with the new syntax by using the builder
- Populate at least one instance of each Slice and publish the document
- Export that document by using the Export option (available from the repository settings, starting with the Medium plan)
- The JSON you got for that document from the Export reflects the syntax you'll use to import documents with the new Slice syntax
- Write a script that transforms the old document JSON output into the new one
- Import JSON documents that have gone through your script (make sure the custom type ID in the JSON for importing is the one of your new custom type), learn more about importing here.
- Change your queries/templates to handle the new API responses