Docs
Quick Start
Creating your first collection

Collections

A collection in Imput is an assortment of content that all shares the same shape.

  • All posts have both a title and an author
  • All authors have an email and an email address
  • And so on...

Add a collection

Collections are added to cms' settings like everything else, you can define collections like this:

const CMS = () => (
  <ImputCMS
    {...{
      settings: {
        // your collections go in here!
        collections: [],
      }
    }}
  />
)

Let's add the most bare-bones configuration for adding new pages. Your config will look something like this:

const CMS = () => (
  <ImputCMS
    {...{
      settings: {
        collections: [
          {
            name: 'page',
            label: 'Page',
            folder: 'content/pages',
            create: true,
            slug: '{{title}}',
            extension: 'mdx',
            fields: [
              { label: 'Title', name: 'title', widget: 'string' },
              { label: 'Content', name: 'body', widget: 'markdown' },
            ],
          },
        ],
      }
    }}
  />
)
  • name should be considered a unique id for your collection
  • label should be a readable string that describes your collection (e.g. "Blog", "Pages", etc.)
  • folder is where your files will be saved and updated in your repository
  • create whether new content can be created for this collection
  • slug is how Imput will generate your new content's filename (add link to slug page here)
  • extension either "md" or "mdx", the file extension Imput will create your new content in
  • fields this is your collection schema, in the example above our content will have a title and a body value

That's the bare minimum config! There's a lot more to collections but we'll go over it later. Next up, writing your first content.