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.
{{ cms.collection.object('seo-site', 'seo-site').tagline }}
Not everything is a list. A homepage has one record. So does an about page, a set of global site settings, or the block of contact details that appears in every footer. Modelling those as an ordinary collection leaves an editor staring at a list with a single row in it, and leaves you guessing at the object's id when you write the template. A singleton collection removes both problems.
Set singleton to true on the collection — in the admin's collection settings, or directly in its .meta.json file — and its behaviour changes. Clicking the collection in the collection view or in QuickNav opens its one object directly, with no one-row list in the way. The Add new button is hidden, because a singleton cannot gain a second object. An empty singleton opens the new-object form, and once that is saved the same object is reused on every visit.
The part that matters to a template author is the id. A singleton's object id is always forced to the collection id, so the record in a collection called seo-site is the object seo-site, and its edit URL is a clean /collections/{collection}/{collection}. There is nothing to look up and nothing to remember.
Converting an existing collection is non-destructive. Flip singleton on and, if the collection already holds more than one object, singleton behaviour stays dormant — the normal list is shown with a notice — until you delete it down to one. Nothing is removed for you. With exactly one object left, that object is adopted and re-keyed to the collection id.
A typical shape: a site-settings singleton holding the phone number, address, social links and default share image, next to a homepage singleton holding the hero headline and the featured post. Both sit in the sidebar beside the blog and gallery collections, both open straight into a form, and both read from a template by name. The client never has to work out which of the two records in a list is the live one, because there is only ever one.
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.