prismic.io offers you two ways to build custom types. You can use our UI builder or code the custom type by hand using the JSON editor.
No matter which you prefer, you can use the JSON editor to retrieve the code with your entire custom type configuration.
Keep track of custom type versions
Simply copy & paste the json code from the JSON editor and put the code into your preferred versioning system.
We recommend keeping track of all of your custom types in a folder in your project files, and tracking all of your project changes in a github repository.
Recommended custom type file structure
There is a specific file structure you can use for your custom types that will make it really easy for your project to act as a prismic.io theme. This will allow you to quickly launch another instance of your project.
You can read more about themes here.
Use the following file structure:
- Start by creating a folder named “custom_types” in the root folder of your project.
- Inside this folder, create a json file for each custom type that you have. Copy & paste the json code from the JSON editor into this file.
- Next you’ll need to create an "index.json" file in the custom_types folder. It will contain the metadata for each of the custom types included in the project. Use the following format:
"name": "Blog Home",
"name": "Blog Post",
In the example above you have two custom types in the index.json file. The first is a single custom type with the id "bloghome" and the name "Blog Home." The other is a repeatable custom type with the id "post" and the name "Blog Post".