# Singletons and single types – Schema Builder

Model site settings and other one-off content in Contentful, which has no singleton or single type setting.

Contentful has no singleton or single type. No content type setting limits it to one entry, as Strapi's single types, Sanity's singletons or Contentstack's single content types do. Site settings, a footer or a cookie banner therefore need a pattern of your choosing. This page compares the usual ones and shows how Schema Builder handles them.

## At a glance

| Approach                               | One entry enforced?        | New content type?              | Best for                                                    |
| -------------------------------------- | -------------------------- | ------------------------------ | ----------------------------------------------------------- |
| A content type with one entry          | No                         | Yes, one per settings group    | A few settings groups whose fields rarely change            |
| A content type with a unique key field | For published entries only | Yes, one per settings group    | Settings where a second published copy would break the site |
| A schema in Schema Builder             | No                         | No, every schema shares one    | Many settings groups, or a space near its content type limit |

## A content type with one entry

Create a content type such as **Site settings**, add one entry and have your website fetch that entry by its ID. Editors can still create a second entry, but the website keeps reading the one it knows, so a stray copy does no harm.

Each settings group (site settings, footer, announcement bar) becomes its own content type. Contentful plans limit how many content types a space can have, and every new one is a content model change.

## A content type with a unique key field

To stop a second copy going live, add a required **Short text** field such as `key`. Turn on **Unique field**, and **Accept only specified values** with a single value such as `site-settings`. Every entry then needs that one value, and Contentful won't publish two entries with the same value. Editors can still create a draft copy, but it can't be published while the first one is.

## Site settings with Schema Builder

With Schema Builder, each settings group is a **schema**, not a content type. An admin defines **Site settings**, **Footer** or **Cookie banner** in the schema editor, with field types and validation. Editors add one entry for each and get a validated form. Every schema shares the one Schema Builder content type, so ten settings groups add no content types.

Your website fetches a settings entry by its schema ID, which Contentful stores in the entry's `type` field:

```text
GET /entries?content_type=schemaBuilderEntry&fields.type=siteSettings&limit=1
```

The values come back together as one JSON object, which suits settings: the website reads the whole group at once. [Fetching entries](https://contentful.geeconglobal.com/apps/schema-builder/docs/fetching) shows the code, through the Delivery API or GraphQL.

> **Things to know**
>
>
> - Schema Builder doesn't limit a schema to one entry. If editors create two **Site settings** entries, the request above returns whichever Contentful sorts first. Agree one entry per settings schema, or give the entry a fixed **Title** and filter on `fields.title` as well.
> - Contentful can't filter by the values inside the JSON. That's rarely a problem for settings, which are read as a whole.
>

## Which to choose

- Two or three settings groups that never change shape: a content type with one entry is simplest.
- A setting the site can't survive having twice, such as a feature flag: add the unique key field.
- Many settings groups, groups that keep changing, or a space close to its content type limit: use Schema Builder schemas.

The same reasoning applies to other one-off content, such as page blocks and campaign content. See [When to use it](https://contentful.geeconglobal.com/apps/schema-builder/docs/when-to-use) for what suits Schema Builder and what doesn't, and [Getting started](https://contentful.geeconglobal.com/apps/schema-builder/docs/getting-started) to set up your first schema.
