Content model
The Content interface, configured fields, references, media, and rich text in the FrontStage API
The FrontStage API has one schema for every Basker site. Routable records share the Content interface. Custom attributes, custom object values, and theme settings share the Field interface. Images and files use Media, and formatted text uses RichText.
Content
A content type is a record with a public URL. Each content type implements Content:
| Type | contentType | Get one | List |
|---|---|---|---|
Page | PAGE | page(id, slug, path) | pages |
Post | POST | post(id, slug) | posts |
Blog | BLOG | blog(id, slug) | blogs |
Event | EVENT | event(id, slug) | events |
EventInstance | EVENT_INSTANCE | eventInstance(id) | eventInstances |
Person | PERSON | person(id, slug) | people |
Work | WORK | work(id, slug) | works |
Venue | VENUE | venue(id, slug) | venues |
Organization | ORGANIZATION | organization(id, slug) | organizations |
Season | SEASON | season(id, slug) | seasons |
Series | SERIES | seriesItem(id, slug) | seriesList |
SmartCollection | SMART_COLLECTION | smartCollection(id, slug) | smartCollections |
Every content type has these fields:
| Field | Description |
|---|---|
id, title, slug | The record ID, title, and slug. |
contentType | One of the ContentType values in the table above. |
path | The site-relative URL in the language of the response. Use it for links. |
locale, alternates | The language of the response, and the same record in each language. See Languages. |
seo | The search and social metadata: title, description, image, canonical, noIndex, and structuredData. Values fall back to the title, description, and image of the record. |
featuredImage | The main image, as Media. |
template, templateSettings | The theme template that the editor chose, for example page.calendar, and its settings as fields. template is null for the default template. |
blocks | The visible blocks of the record, in order. See Theme blocks and Website builder blocks. |
introBlocks, outroBlocks | On a website builder site, the blocks that the template of the record shows before and after blocks, such as a masthead or a list of performances. Empty on custom-theme sites. |
customAttributes, customAttribute(key) | Custom attribute values as fields. See Custom objects and attributes. |
createdAt, updatedAt | ISO 8601 date-times. |
Each type adds its own fields, for example Event.startDate, Event.venue, Event.credits, Event.instances, Page.children, and Post.authors. See Content types.
Some types also have fields of type JSON, such as Event.image, Event.attributes, and Person.theme. These fields return the same shape as the REST API and Liquid templates. Prefer the typed fields: featuredImage, customAttributes, and templateSettings.
Fields
A field is one configured value: a custom attribute, a custom object value, a theme setting, a template setting, or a theme block setting. Each one implements Field with key, label, and type. label is the label set in the admin. type is the stored field type, for example text, richText, selectMany, relationship, or group.
The GraphQL type tells you where the value is:
| GraphQL type | Value fields |
|---|---|
TextField | value |
NumberField | number |
BooleanField | boolean |
DateField | value: an ISO 8601 date-time in UTC. timezone: the time zone the editor chose, if any. |
SelectField | value: the first selected value. values: every selected value. options. |
ColorField | value |
JsonField | json |
RichTextField | richText: a RichText. |
MediaField | media, mediaList, hasMany |
ReferenceField | reference, references, relationTo, hasMany |
LinkField | href, text, newTab, linkType: internal or external. target: the linked record. |
GroupField | fields, field(key) |
ListField | items: a list of FieldGroup, each with fields and field(key). |
The value fields have different names, so one fragment can select all of them without aliases. Use this fragment as a start:
fragment FieldValue on Field {
__typename
key
type
label
... on TextField { value }
... on NumberField { number }
... on BooleanField { boolean }
... on DateField { value timezone }
... on SelectField { value values options { label value } }
... on ColorField { value }
... on JsonField { json }
... on RichTextField { richText { html text } }
... on MediaField { media { url alt width height } }
... on LinkField { href text newTab linkType target { __typename ... on Page { path } } }
... on ReferenceField {
relationTo
hasMany
references {
__typename
... on Content { title path }
... on CustomObject { type title }
}
}
}A fragment cannot include itself. To read groups and lists, repeat the fragment one level down:
query EventAttributes($slug: String!) {
event(slug: $slug) {
customAttributes {
...FieldValue
... on GroupField { fields { ...FieldValue } }
... on ListField { items { fields { ...FieldValue } } }
}
}
}References
A ReferenceField returns records of the Reference union: any content type, CustomObject, SmartCollection, Media, Form, ReusableSection, Author, Category, or Tag.
referencesreturns every referenced record that is published and public, in the order the editor set.referencereturns the first one.- A reference to a draft, a deleted record, or a private custom object does not appear.
Each reference loads only the fields that your query selects. Select only what the view needs.
Media
Media is an uploaded image or file. It has url, alt, caption, credit, width, height, mimeType, filename, filesize, focalPoint, and sizes.
To resize or convert an image on the CDN, pass transform to url:
query Portrait($slug: String!) {
person(slug: $slug) {
name
featuredImage {
alt
width
height
thumbnail: url(transform: { width: 400, height: 400, fit: cover, format: webp, quality: 80 })
large: url(transform: { width: 1600, format: avif })
}
}
}ImageTransform field | Description |
|---|---|
width, height | The size in pixels. |
fit | cover, contain, fill, inside, or outside. |
format | avif, webp, jpeg, or original. |
quality | The encoding quality. |
When you set a width or a height and the image has a focal point, the crop keeps the focal point in view. Basker ignores transform for files that are not images. Use aliases to get more than one size in one query.
Rich text
RichText gives one value in three forms:
| Field | Use it for |
|---|---|
html | Ready-to-render HTML. Basker produces the same HTML for a site that it renders. |
text | Plain text, for excerpts, meta descriptions, and aria-label values. |
json | The editor JSON, for a custom renderer. Internal links and uploads have their URLs filled in. |
query Biography($slug: String!) {
person(slug: $slug) {
biographyText {
html
text
}
}
}