Contentful
Adding Shopstory field to a content type
Shopstory content can be added to any of your content types by adding 3 consecutive fields:
id:
fieldId
, type:JSON
, localisation: on, appearance: Shopstory Appid:
fieldIdReferences
, type:Reference (many)
, localisation: offid:
fieldIdMediaReferences
, type:Media (many)
, localisation: off
The first field is the main JSON
field that stores Shopstory visual content.
The references and media references fields (2. and 3.) display all the references used by Shopstory content. Thanks to them users can easily see the status of entries linked by Shopstory content (published / draft / changed), they also makes the "References" Contentful tab works properly.
Naming convention is super important! The main JSON
field can have any id
but in order to correctly find its references and media references Shopstory requires 2. and 3. to be named {id}References
and {id}MediaReferences
. This allows Shopstory to correctly connect main JSON field with its references field.
Can I add more than one Shopstory field in a content type?
There is no limitation in terms of how many Shopstory fields are added to a single content type. For example, if ecommerce product page has a standard product head section (with gallery, product info and buy button), the extra content blocks can be allowed both at the top and at the bottom of the section. In this scenario adding 2 separate Shopstory fields is recommended.
Built-in resource types
There are 2 built-in resource types:
contentful-asset
contentful-entry
contentful-asset
contentful-asset
contentful-asset
resource type takes 1 parameter:
mimeTypeGroups
- array of mime type groups allowed by Contentful, for exampleimage
orvideo
Default fetch for contentful-asset
is a standard asset fetch by Contentful Client SDK.
contentful-entry
contentful-entry
contentful-entry
takes 1 parameter:
contentTypeId
(string
|string[]
) - a list of content types allowed
Code example:
Default fetch for contentful-entry
is a standard entry fetch by Contentful Client SDK with include: 5
.
Last updated