Schema

A schema is a collection of Types.

alinea.schema('My schema', {
  TypeA, TypeB, TypeC
})

Example schema

The schema below is a minimal example of a blog setup. It is comprised of two types: BlogOverview and BlogPost. The overview type corresponds to a page that lists the posts. To achieve that it is configured as a container which can hold blog posts as children.

alinea.schema({
  BlogOverview: alinea.document('Blog overview', {
    [alinea.meta]: {
      isContainer: true,
      contains: ['BlogPost']
    }
  }),
  BlogPost: alinea.document('Blog post', {
    publishDate: alinea.date('Publish date'),
    body: alinea.richText('Body')
  })
})