> For the complete documentation index, see [llms.txt](https://docs.shopstory.app/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.shopstory.app/cms-guides/contentful.md).

# Contentful

## Adding Shopstory field to a content type

Shopstory content can be added to any of your content types by adding 3 consecutive fields:

1. id: `fieldId`, type: `JSON`, localisation: on, appearance: Shopstory App
2. id: `fieldIdReferences`, type: `Reference (many)`, localisation: off
3. id: `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:

1. `contentful-asset`
2. `contentful-entry`

#### `contentful-asset`

`contentful-asset` resource type takes 1 parameter:

* `mimeTypeGroups` - array of mime type groups allowed by Contentful, for example `image` or `video`

```typescript
{
  prop: "someEntry",
  type: "resource",
  resourceType: "contentful-asset",
  params: {
    mimetypeGroups: ['image']
  }
}
```

Default fetch for `contentful-asset` is a standard asset fetch by Contentful Client SDK.&#x20;

#### **`contentful-entry`**

`contentful-entry` takes 1 parameter:

* `contentTypeId` (`string` | `string[]`) - a list of content types allowed&#x20;

Code example:

```typescript
{
  params: {
    contentTypeId: [`ContentType1`, `ContentTypeId2`]
  },
  prop: 'link',
  resourceType: 'contentful-entry',
  type: 'resource'
}
```

Default fetch for `contentful-entry` is a standard entry fetch by Contentful Client SDK with `include: 5`.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.shopstory.app/cms-guides/contentful.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
