A type defines fields and presentational settings. Fields hold data that can be edited in the dashboard. Top level types which are used in a schema need to define both a title and path field.
alinea.type('My type', {
title: alinea.text('Title', {width: 0.5}),
path: alinea.path('Path', {width: 0.5})
})
Alinea ships with a number of useful fields that can be added to by creating custom fields.
A type can be configured by using the configure function:
alinea.type('Example type').configure({
...configuration
})
When a type is marked as a container it can contain subpages.
isContainer: true
In case this type is a container the allowed sub types can be declared in an array.
contains: ['PageA', 'PageB']
The url property of entries can be controlled using the entryUrl function in the type options. Urls are computed during generation and this can help to keep them constant if you're using a web framework that does file system routing. The available parameters are path, parentPaths and locale. For example: making sure a doc page always has an url in the form of /doc/$path you can specify entryUrl as the following:
entryUrl({path}) {
return `/doc/${path}`
}
An icon can be used to label a type in the sidebar entry tree. Icons are implemented as a React component. You can find icons on Icones or install a package such as react-icons.