FeaturesContent Modeling

One record, edited in place

Some content only ever has one of it. A singleton collection holds exactly one object, opens straight to its edit form, and hides the Add new button.

Standard Included in Standard and Pro

Update Your Phone Number on Every Page of a Website at Once
Update Your Phone Number on Every Page of a Website at Once

Some content only ever has one record: a homepage, an about page, global site settings, the contact details in every footer. A singleton collection holds exactly one object, so an editor never faces a one-row list and you never guess its id in a template.

Turning it on

Set singleton to true in the admin's collection settings or in the collection's .meta.json file.

  • Straight to the form. Clicking the collection in the collection view or in QuickNav opens its one object directly.
  • No Add new button. It is hidden, because a singleton cannot gain a second object.
  • Empty to start. An empty singleton opens the new-object form; once saved, that object is reused on every visit.

Converting an existing collection

  • Non-destructive. If the collection holds more than one object, singleton behaviour stays dormant and the normal list shows a notice until you delete it down to one. Nothing is removed for you.
  • The last one is adopted. With exactly one object left, it is adopted and re-keyed to the collection id.

An id you already know

The object id is always forced to the collection id: the record in seo-site is the object seo-site, edited at a clean /collections/{collection}/{collection}. Nothing to look up. A typical pair:

  • site-settings holds the phone number, address, social links and default share image.
  • homepage holds the hero headline and the featured post.

Both sit in the sidebar beside the blog and gallery collections, open straight into a form, and read from a template by name. The client never has to work out which record in a list is the live one.

In practice

What it looks like in a template

twig
{{ cms.collection.object('seo-site', 'seo-site').tagline }}

A singleton's object id equals its collection id, so it reads by name from any template.

At a glance

What you get

No list to click through
Clicking a singleton in the collection view or QuickNav opens its one object directly, rather than a list with a single row in it.
A predictable id
The object's id is always the collection id, so a template addresses it by name with no lookup and no guesswork.
No second object
The Add new button is hidden. A singleton cannot gain a second record by accident, so there is never a wrong one to edit.
Safe to convert
Turning singleton on never deletes anything. With more than one object present the flag stays dormant and the admin shows a notice explaining why.

Singleton collections

Common questions

What happens if the collection already holds several objects?

Singleton behaviour stays dormant and the normal list is shown with a notice. Once you delete the collection down to one object, that object is adopted and re-keyed to the collection id. Nothing is deleted for you.

What id does the single object get?

The collection id. A singleton called settings holds one object with the id settings, and its edit URL is /collections/settings/settings.

Where is the setting?

On the collection, not the schema. Edit it in the admin's collection settings, or set singleton to true in the collection's .meta.json file.

What is a singleton good for?

Site-wide settings, global configuration, and single pages such as a homepage or an about page — anything where a list of one would be noise.

Try it on a site of your own.

45 days, every Pro feature, no credit card. Build it, hand it to a client, and see what they can and can’t touch.