statically.
Building sites

Blueprints

Each kind of content is a JSON blueprint: its fields, how the client's form is laid out, and where its pages live.

One file per kind of content, named after its handle: blueprints/office.json has "handle": "office". The client panel builds its forms from these files.

blueprints/office.json
{
  "version": 1,
  "handle": "office",
  "label": "Offices",
  "singular": "office",
  "nestable": true,
  "prefix": "offices",
  "seo": { "descriptionFrom": "intro", "imageFrom": "photo" },
  "fields": [
    { "name": "title", "type": "text", "label": "Office name", "required": true },
    { "name": "intro", "type": "textarea", "maxLength": 300 },
    { "type": "tabs", "tabs": [
      { "label": "Details", "fields": [
        { "name": "address", "type": "textarea", "required": true },
        { "name": "phone",   "type": "text" },
        { "name": "photo",   "type": "media", "accept": ["image"] }
      ]},
      { "label": "Team", "fields": [
        { "name": "people", "type": "relation", "to": "person", "many": true }
      ]}
    ]}
  ]
}

A field named title is the entry's title: what the panel lists it by. Without one, entryLabel builds it, for example "{last_name}, {first_name}".

Field types

  • text, textarea: with placeholder, maxLength, default (and prefix/suffix for text)
  • richtext: limited HTML, with tools from heading, bold, italic, list, link. Headings become <h3>
  • number: min, max, step, prefix, suffix
  • boolean, date, select (with options and optional multiple)
  • media: images or documents, stored with alt text and the client's focal point
  • relation: links to entries of another blueprint, with many and max
  • repeater: a list of rows, with noun, summary, min and max (up to 50)

Every field also takes label, required, help and visibleWhen.

Repeater or blueprint?

If it needs its own page, needs filtering or sorting across entries, or could grow past a few dozen rows, it's a blueprint with a relation. Team members are people (a blueprint) linked from an office; opening hours are a repeater. Relations can't go inside a repeater.

Laying out the form

Containers arrange fields without changing the data: section, fieldset, tabs and columns (2 to 4, stacking on narrow screens). A field's name is unique across the whole entry however deeply it's nested.

Show a field only sometimes with visibleWhen, using equals, notEquals, in, filled or empty. A hidden field isn't saved.

Conditional field
{ "name": "office", "type": "relation", "to": "office",
  "visibleWhen": { "field": "is_remote", "equals": false } }

Where each one lives

  • A top-level page: no keys needed. /jane-smith/
  • A pattern: "route": "/team/{slug}" gives /team/jane-smith/
  • Pages inside pages: "nestable": true, with an optional prefix and parentTypes. /offices/cardiff/bay/
  • Just one, at one address: "singleton": true with a route, such as the homepage at / or a pricing page

Give one-off singletons "listIn": "page" so the client finds them in their Pages list, marked "Own layout", rather than as a separate item in the sidebar.

Every entry is published as a page, so every blueprint needs a template, even one whose entries are mostly shown elsewhere (testimonials listed on the homepage). A missing template fails the build and names it.

Choose names carefully

Templates read fields by name. Renaming a field later leaves saved values under the old name, so settle names before the client starts adding content.

Other blueprint keys

  • listColumns: a few top-level fields shown as columns in the panel's list
  • sortable: the client orders entries by dragging (flat lists only)
  • seo and schema: see SEO, analytics and cookies
  • suggestions: lets a news or blog blueprint receive suggested posts as drafts for review