A schema is a collection of types.
alinea.schema('My schema', {
TypeA, TypeB, TypeC
})
Schemas currently have no configuration options, other than the types.
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.type('Blog overview', {
title: alinea.text('Title'),
path: alinea.path('Path')
}).configure({
isContainer: true,
contains: ['BlogPost']
}),
BlogPost: alinea.type('Blog post', {
title: alinea.text('Title'),
path: alinea.path('Path'),
publishDate: alinea.date('Publish date'),
body: alinea.richText('Body')
})
})