Content Modelling
Entries
The Entry content type is designed for single entry content that you would like to reuse but that doesn’t require a slug or its own SEO.
Using an entry means you can create the content once and then reuse it on different pages either by outputting the entry directly in the code or using the Content Link field type within a Block if you want to be able to choose which entries are going to be outputted.
General Entry Settings
All Entries have a name
and a handle
field. The handle
is auto generated from the name
in snake_case
and can be edited before the first save. After the blocks initial save - when you click Create, the handle
is not editable.
Once you have created your Entry, you will be able to add fields of your choice from the Fields list.
A good example of Entry use is for your navigation. It is a piece of content that you typically only want to have one version of that will be used across your whole website including across different page types. In this example we are using a title
field to give the Entry a name that will be seen only in the CMS, and a nav_links
block field where you can add nav_link
blocks for each link you want to have in your navigation.
Entries are also great for things like blog categories or other additional meta data and filtering systems.
Code Examples
JSON
This is an example of the JSON
object for an Entry.
{
id: 'c_01HWCZVV0pHtea613d6tD9SPsm',
published_at: '2024-03-08T16:07:55+00:00',
slug: null,
name: 'Example Entry',
uri: null,
url: null,
created_at: '2024-04-26T10:40:22+00:00',
updated_at: '2024-04-26T10:40:22+00:00',
author: {
id: 'u_01hv8wF8as1HnV6nBDhwe13HDx',
name: 'Hollie Duncan',
email: '[email protected]',
profile_photo_url: 'https://ui-avatars.com/api/?name=H+D&bold=true&size=256&color=008673&background=00D6B5&font-size=0.4&format=svg'
},
content_type: {
id: 'ct_01Hwczv9A4WXV1EEr21Q2Jt2v9',
name: 'Example Entry',
handle: 'example_entry',
object_type: 'entry'
},
fields: {...}
}
TypeScript
This is an example of how you can request specific entry data from the API and use it for your navigation in a <Header />
component.
const mainNav = await createClient()
.getContentById(c_01YWLZVV0pHtea623d6tD7SPct)
.catch(() => {
notFound()
})
<Header mainNav={mainNav} />