Version Your Custom Types

On this page you'll learn how to version, disable, delete, and restore your Custom Types.


Version

Whenever you create a Custom Type using the drag-and-drop builder, JSON is automatically generated in the JSON editor tab. This JSON structure has all the configurations of the Custom Type.

It is useful to use this code to version your Custom Types. This is how we recommend you do it in your project:

  1. Create a folder in your project files called custom_types.
  2. Create one file per Custom Type in your repo using the Custom Types' respective names.
  3. Copy-paste the JSON code from the JSON editor and place it in the corresponding file.
  4. Next, create an index.json file in the custom_types folder. This will contain the metadata for each of the custom types included in the project. Use the following format:
Copy
[
   {
      "id":"bloghome",
      "name":"Blog Home",
      "repeatable":false,
      "value":"bloghome.json"
   },
   {
      "id":"post",
      "name":"Blog Post",
      "repeatable":true,
      "value":"post.json"
   }
]

5. Finally, save your changes in Git or another version control system.

Disable

To disable a Custom Type, open the Custom Type list, locate it, then click the Disable button.

When you do this, the Custom Type will appear in the Disabled tab, and you won't be able to create any more documents of this type. All previously created documents will remain in your document list.

Restore

To restore a previously disabled Custom Type. Go to the Disabled tab and click the Restore button for that type.

The type will now appear with the Active Custom Types, and you will once again be able to add new instances of the type.

Delete

If you no longer need a Custom Type, you can delete it completely.

  1. Delete all the documents of that type. Here is an article that explains how to Archive and Delete Documents.
  2. Disable the type as explained in the Disable section of this article.

Once you've done this, go to the Disabled tab of the Custom Type page and click the Delete button for that type.

If you have deleted a Custom Type and attempt to create a new type with the same name, you might get an error message saying Type ID already used.

Recover after deleted

Your Prismic Repository saves the URLs of the deleted Custom Types if you might need to recover them.

For example, if you have deleted a Custom Type with the API ID of "Article", you need to go to the following URL (replace your-repo-name with the name of your repository):

Copy
https://your-repo-name.prismic.io/masks/article.json/

This URL will take you to the edit screen for the Custom Type, where you will be able to make your changes and save the type again to recover it.


Was this article helpful?
Not really
Yes, Thanks

Can't find what you're looking for? Get in touch with us on our Community Forum.