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.meta]: {
isContainer: true
}
})
isContainer
When a type is marked as a container it can contain subpages.
isContainer: true
contains
In case this type is a container the allowed sub types can be declared in an array.
contains: ['PageA', 'PageB']
entryUrl
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}`
}
icon
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.