Publish your CMS collections as JSON
Share a collection's published items as JSON files from your own site, for an app, another website or a script. What you get with several collections on.
Publish as JSON adds the published items of a collection to your site as JSON files. An app, another website or a script
can read them, and you don't run a server. flipsite.io does it too: flipsite.io/cms/index.json is a live index.
Turn it on for a collection
-
1Open the CMS.
-
2Right-click the collection, or click its options button, and choose Publish as JSON.
-
3Publish your site.
It is off by default and set per collection. There is no select all. Ten collections take ten clicks, which is also ten
chances to notice the one you didn't mean to share. An agent does the same with publishJson in cms_collection_edit.
What you get with several collections on
Every collection that is on gets its own files, next to sitemap.xml and llms.txt:
-
cms/index.json: the index of every collection that is on -
cms/<collection>.json: all published items of one collection -
cms/<collection>/<itemId>.json: one item
There is one index for the whole site, so a reader needs one address to find everything. A collection that is off has no files and is not in the index. llms.txt lists the ones that are on under Data. Here is an index for a site in English and Finnish with the Team collection on:
{
"name": "Example Studio",
"url": "https://example.com/",
"languages": ["en", "fi"],
"defaultLanguage": "en",
"collections": [
{
"id": "team",
"name": "Team",
"help": "The people on the team page",
"count": 2,
"url": "https://example.com/cms/team.json",
"itemUrl": "https://example.com/cms/team/{id}.json",
"fields": [
{ "id": "name", "type": "text", "localizable": false },
{ "id": "role", "type": "text", "localizable": true },
{ "id": "photo", "type": "image", "localizable": false }
]
}
]
}
What an item looks like
An item has an _id and its fields by field id. _url is the address of its page, when the collection has a template page. With more than one language, _url and every translatable field have one value per language, and a missing translation
falls back to the default language. Images give the published address with width and height, and wide ones are scaled to
1600 pixels. Rich text comes as blocks plus HTML, and references are lists of item ids.
{
"_id": 1,
"_url": { "en": "https://example.com/team/anna/", "fi": "https://example.com/fi/tiimi/anna/" },
"name": "Anna",
"role": { "en": "Designer", "fi": "Suunnittelija" },
"photo": { "src": "https://example.com/assets/anna.webp", "width": 800, "height": 800 }
}
Nothing is public until you publish
Flipsite makes the files when you publish, like the rest of the site. Switching a collection on or off, or editing an item, changes nothing live until the next publish, and items that aren't published are never included. The files are plain static files, so this works with every way of publishing.
Limits
The JSON is read only, and you can't filter or search it. It is public, so turn it on only for content you would show on a page anyway. If a page has the same address as one of the files, the page wins.
Frequently asked questions
Related articles
Bind CMS collections to your design
Repeat a section or component for each item in a collection, and show the fields of the item in it.
Use rich text in pages and the CMS
Write formatted text with headings, lists, links, tables and media, in the editor or in the CMS.
robots.txt, sitemap.xml and llms.txt
The files that Flipsite makes for search engines and AI when you publish, and how to replace them.
Publish files in the site root
Publish verification files, .well-known files and your own robots.txt in the root of your domain.
CMS item pages and reference fields
Give each item of a collection its own page, and connect items to each other with reference fields.