Show navigationHide navigation

Fields Overview

Fields define the shape of each content entry. They are declared per collection in cms/octocms.config.ts:

typescript
collections: {
  post: {
    label: 'Post',
    hasMany: true,
    fields: {
      title: { label: 'Title', format: 'string', entryTitle: true, required: true },
      body: { label: 'Body', format: 'markdown' },
      category: { label: 'Category', format: 'select', options: [...] },
    },
  },
}

Available field types#

FormatDescriptionPage
stringSingle-line text inputTags, names, titles
textMulti-line textareaDescriptions, summaries
markdownRich markdown editorBlog posts, documentation
richtextWYSIWYG editor with embedsLanding pages, newsletters
booleanYes / No toggleFeatured flags, toggles
selectDropdown or checkbox listCategories, statuses
numberNumeric inputPrices, sort order
datetimeDate or date-time pickerPublish dates, event times
imageMedia library picker + uploadCover photos, avatars
slugURL-safe identifierPage URLs, permalinks
urlURL input with validationExternal links, social profiles
colorColor picker with hex outputBrand colors, category badges
jsonRaw JSON editorStructured metadata, configs
referenceLinks to other entriesPost → author, page → posts
conditionalContent variants with branch selectionA/B tests, feature flags

Common options#

Every field supports these options:

OptionTypeDescription
labelstringDisplay name in the editor (required)
formatstringField type (required)
requiredbooleanPrevent saving when empty. Default: false
hintstringHelper text shown below the field in the editor
entryTitlebooleanUse this field as the entry title in the sidebar. One field per collection.
searchablebooleanInclude in full-text search index. Default: true for text-like fields

Validation#

Validation runs twice: in the editor before save (immediate feedback) and server-side in saveFile (cannot be bypassed).

When validation fails:

  • Error messages appear under the affected fields
  • Fields show an error state (red border)
  • The Save button stays disabled until all errors are resolved

Each field type has its own validation rules — see the individual field pages for details.

Entry title#

Mark one field per collection with entryTitle: true. This field is used as the display name in the sidebar list and reference selectors:

typescript
fields: {
  name: { label: 'Name', format: 'string', entryTitle: true },
}

If no field is marked, the entry ID is used as the title.