Basker Docs

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:

TypecontentTypeGet oneList
PagePAGEpage(id, slug, path)pages
PostPOSTpost(id, slug)posts
BlogBLOGblog(id, slug)blogs
EventEVENTevent(id, slug)events
EventInstanceEVENT_INSTANCEeventInstance(id)eventInstances
PersonPERSONperson(id, slug)people
WorkWORKwork(id, slug)works
VenueVENUEvenue(id, slug)venues
OrganizationORGANIZATIONorganization(id, slug)organizations
SeasonSEASONseason(id, slug)seasons
SeriesSERIESseriesItem(id, slug)seriesList
SmartCollectionSMART_COLLECTIONsmartCollection(id, slug)smartCollections

Every content type has these fields:

FieldDescription
id, title, slugThe record ID, title, and slug.
contentTypeOne of the ContentType values in the table above.
pathThe site-relative URL in the language of the response. Use it for links.
locale, alternatesThe language of the response, and the same record in each language. See Languages.
seoThe search and social metadata: title, description, image, canonical, noIndex, and structuredData. Values fall back to the title, description, and image of the record.
featuredImageThe main image, as Media.
template, templateSettingsThe theme template that the editor chose, for example page.calendar, and its settings as fields. template is null for the default template.
blocksThe visible blocks of the record, in order. See Theme blocks and Website builder blocks.
introBlocks, outroBlocksOn 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, updatedAtISO 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 typeValue fields
TextFieldvalue
NumberFieldnumber
BooleanFieldboolean
DateFieldvalue: an ISO 8601 date-time in UTC. timezone: the time zone the editor chose, if any.
SelectFieldvalue: the first selected value. values: every selected value. options.
ColorFieldvalue
JsonFieldjson
RichTextFieldrichText: a RichText.
MediaFieldmedia, mediaList, hasMany
ReferenceFieldreference, references, relationTo, hasMany
LinkFieldhref, text, newTab, linkType: internal or external. target: the linked record.
GroupFieldfields, field(key)
ListFielditems: 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.

  • references returns every referenced record that is published and public, in the order the editor set.
  • reference returns 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 fieldDescription
width, heightThe size in pixels.
fitcover, contain, fill, inside, or outside.
formatavif, webp, jpeg, or original.
qualityThe 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:

FieldUse it for
htmlReady-to-render HTML. Basker produces the same HTML for a site that it renders.
textPlain text, for excerpts, meta descriptions, and aria-label values.
jsonThe 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
    }
  }
}

On this page