Get the content from all singletons in an array

Hey there,

Background: My company builds websites for clients with a very free-form, “editorial” sort of content structure.

  • I use collections to hold entries that have the same fields, such as information about team members or projects in case studies.
  • I use singletons to hold data when each singleton entry has unique fields-- not only for global site data like meta, titles, and descriptions, but also for the content of each page, since the content structure of different pages is expected to vary (though I’ve never seen an example that uses singletons for page content, it seems to me that collections is preferred)

To me, this seems like the ideal way to organize everything, but there’s no way I know of to get all singletons as an array from the API.

I don’t think, that this will be implemented soon… Singletons are “single” items. But they are stored in one database, so it is possible to get them altogether already - but I never really tested it. Try your luck and if you have a working code snippet, that might be useful for others, feel free to post it here or in the linked thread.