Collections
An Imput collection is a grouping of similar content, you can use collections to split up content that is similar. For example:
- "Blogposts" is a collection that contains all of your blog's content
- "Authors" is a collection of the people who write said blogs
- "Categories" is a collections of the categories your blog posts fall under
If you're familiar with databases you can think of each collection as its own table in a database, except instead of being a database they're markdown files contained in a folder
You can define a specific "schema" for each collection, which will define the shape of the data of each item in that collection. Your "schema" (Imput calls them fields!) will define which inputs appear when creating or editing content.
Each collection can also define any number of "blocks". Blocks are just React components that can be inserted in your markdown.
Collections API
Prop | Type | Default |
---|---|---|
name* | string | - |
label* | string | - |
folder* | string | - |
create* | bool | - |
slug* | string | - |
extension* | enum | - |
fields* | array | - |
blocks | array | - |
preview | object | - |
Slug
The slug
option allows you to configure how new filenames are generated. Check out the slug documentation for all the possible options.
Slug documentation
Fields
The field
array in your collection configuration is used to define which inputs should appear when creating or modifying content in that specific collection.
Fields documentation
Blocks
The blocks
array in your collection is used to specify which MDX components the collection will be able to create in the editor. This array allows you to define a specific schema for each component.
Blocks documentation
Preview
The preview
object can be used to render HTML and JSX in the preview panel next to the editor instead of plain markdown.
Preview documentation
Content view
Learn how to customise the way your posts are listed.