Skip to content

data.json: request the data you need

This file declares which platform data your components need. It is a small list of named requests, not a place to write GraphQL, SQL, fetch calls or executable code.

data.json
{
"content": {
"source": "content"
},
"recentArticles": {
"source": "articles",
"blog": {
"slug": "journal"
},
"order": "newest",
"take": 3,
"allowUserSelection": true
}
}

recentArticles is a name you choose. Its request asks for the three newest articles in the journal blog. The component receives the result as data.recentArticles. The content request exposes the current editable content as data.content; the SDK also supplies content directly.

Source Result Additional keys
content Current language’s content object None
assets Resolved image assets None
settings Platform settings object None
design Design configuration None
pages Visible non-blog editorial pages None
articles A limited array of blog articles blog, order, take; optional allowUserSelection
article One article or null blog, slug
blog Blog, its articles and page size blog, pageSize

For an article list, order is newest, oldest or editorial, and take is between 1 and 100. For a blog request, pageSize is between 1 and 100.

"blog": { "slug": "journal" } fixes the source in code. Alternatively, "blog": { "field": "journalBlog" } reads a declared text field from content. Add that field to your definition before using it. Choose one selector, not both.

allowUserSelection: true lets the owner choose Automatic or Manual article selection for that requirement. The developer still fixes the source blog and maximum count. A manual list may contain fewer items or no items; do not add automatic filler.

This is distinct from editor.json.collections: article selection chooses platform articles, while collections organize editable list fields you defined yourself.

Run shoplifter types after changing requests. It updates src/generated/project.d.ts, so components can use the result names and shapes safely.