Content types
A content type is a kind of document. It decides how documents of that kind are addressed and what they may contain.
Anatomy
| Property | What it is |
|---|---|
| API id | The identifier used in the API and by developers: page, article, legal. Lower case, no spaces, and hard to change later. |
| Label | What editors see in the console. |
| Kind | How the document is addressed and rendered. |
| Has blocks | Whether documents are built from sections. |
| Allowed blocks | Which block types may be used, when it has blocks. |
| Fields | Fields on the document itself, beyond its blocks. |
Kinds
| Kind | Addressed by | Renders at |
|---|---|---|
page | a route, like /about | its own URL |
document | a route | its own URL |
partial | a key, like nav | inside other documents |
redirect | a route | nothing; it sends visitors elsewhere |
page and document behave identically; use document for things that are not really pages of the site's navigation, such as articles.
partial is for pieces included by other documents. A partial has no URL and cannot be visited. Its key is how documents refer to it.
redirect documents hold a destination and whether the redirect is permanent. See Redirects.
Allowed blocks
The most useful thing a content type does is limit which sections may be used.
An article that offers a pricing table will eventually contain one. Restricting the list keeps documents consistent without anyone policing it, and it makes the "add a block" catalogue short enough to read.
Add block types deliberately rather than allowing everything.
Document fields
A content type can declare fields on the document itself, for things that are not part of any section: an article's author and publication date, a legal notice's effective date.
These appear in page settings rather than on a block.
Choosing an API id
The API id ends up in code, in URLs and in your site's registry. Changing it later means changing every document of that type and every place the site refers to it.
Use a singular noun: article, not articles or blog-post-type.