🚀 Ship faster with premium components 🚀
Search documentation v1.5.0

Content Types

Define and manage your content structure

Content types are the foundation of your content model. Every piece of content in the CMS, whether it’s a blog post, a team member, a product, or a property listing, belongs to a content type. The type defines the shape of the data: what fields it has, what those fields accept, and whether it supports block composition.

Content types are listed in the CMS sidebar and can be created, reordered, and deleted at any time. Each type you create is immediately available to editors as a new section in the sidebar.

Content Types
Content types will appear in the sidebar. The CMS will generate the above types with all fields preconfigured for reference.

Managing Types

Navigate to Content Types in the CMS to see all existing types. From here you can:

Deleting a type is permanent and cascading
All fields and all content entries belonging to the type will be deleted along with it. If the type has existing entries, you will be required to type the type identifier to confirm before deletion proceeds.

Type Options

Each content type has the following options, editable from its sidebar panel:

Note
Changing the Type identifier on an existing type affects any frontend code that references it. You will be warned of how many entries are affected before the change is applied, but updating references in your Astro pages is your responsibility.

Fields

Fields define the data shape of a content type. Each field you add appears as an editable control when creating or editing a content entry of that type. Fields can be reordered by dragging, and a live preview of the entry form is available while editing the type.

Content Types

When a field is changed or deleted on a type that already has entries, the CMS will warn you of how many entries (and how many published entries) will be affected before applying the change. Every field has the following base options:

Input

The input kind renders an editable control in the entry editor. The specific control is determined by the Input Type option:

Separator

The separator kind renders a visual divider in the entry editor. It stores no data and is purely organizational. Useful for grouping related fields within a long form.

Block

The block kind lets you associate a structured block with an entry field. When a field is set to block, you choose which block type it maps to from a searchable list of all available blocks in your project.

The CMS ships with over 100 prebuilt blocks (components available from the component library, as well as premium blocks available from Webcore Pro). You can also create your own custom blocks and they be added to the list by setting up a new schema.

This is how relational-style data is modelled in the CMS. For example, to associate an author with a blog post, you would add a field of kind block and set its block type to Author. The entry editor will then let the editor configure the properties of the author and your frontend can resolve the full author data.

Using Content Types on the Frontend

Content types are queried on the frontend using the getContentType helper, which returns all entries of a given type along with their fields and blocks. It is designed to be used directly inside getStaticPaths in your Astro pages. You’ll find example usage in the pages folder.

Unlock CMS
Example usage of getContentType in a [...blog].astro route
import { type ContentTypeData, getContentType } from '@utils/server'
export type BlogFields = {
url: string
title: string
description: string
author?: Block<ReferenceProps>
image?: Block<ImageProps>
}
export const getStaticPaths = () => getContentType<BlogFields>('blog', 'blog')
interface Props extends ContentTypeData<BlogFields> {}
const {
id, // ID of the entry
state, // "published", "draft", or "archived"
stateName, // A human-readable label for the state
entry, // The content entry's fields and options
blocks // An array of blocks belonging to the entry. Can be passed directly to <ComponentMap /> to render them.
} = Astro.props
A content type must have a field named url for getContentType to generate routes for it. In production, the function additionally filters out entries that are not in a publicly visible state.
  1. To get a full type safety on entry.fields throughout your page component, type the field shape and pass it as a generic to getContentType.
  2. The helper expects a content type identifier and a route parameter name (if not set, it’ll default to route). The route parameter must match the name of your Astro file’s dynamic segment (e.g. in the example above [...blog].astro would require a route parameter named blog).
  3. Each entry is returned with its typed fields, its blocks in order, and its current state and stateName, which you can use to display draft or preview indicators on the frontend.

Permissions

Access to content types is governed by the following permissions, assignable per role:

PermissionDescription
types:read Required to view the content types list and open individual types.
types:create Required to create new content types.
types:update Required to edit type options and add, edit, reorder, or delete fields.
types:delete Required to delete a content type and all its entries.