Shopstory
Search
K

Sanity

Adding Shopstory field to a content type

Shopstory Sanity plugin provides a new field type shopstory so adding Shopstory field is as simple as:
defineField({
name: "field_name",
type: "shopstory",
}),

Built-in resource types

There are 3 built-in resource types for Sanity:
  • sanity.document
  • sanity.image
  • sanity.file

sanity.document

sanity.document resource type can take 1 parameter:
  • documentType (string[]) - the list of allowed document types
Example:
{
prop: "section",
type: "resource",
label: "Sanity Section",
resourceType: "sanity.document",
params: {
documentType: [
"block_banner",
"block_twoColumns",
"block_productsGrid",
],
},
}
Default fetch behaviour for sanity.document is a GROQ call that fetches all field values without fetching deeper references.

sanity.image

{
prop: "image",
type: "resource",
label: "Sanity image",
resourceType: "sanity.image",
}

sanity.file

{
prop: "file",
type: "resource",
label: "Sanity file",
resourceType: "sanity.file",
}
Last modified 10mo ago