Skip to content

Commit

Permalink
typo and polishing
Browse files Browse the repository at this point in the history
  • Loading branch information
slk333 authored Jan 13, 2020
1 parent 9a8e7c3 commit 03d85d3
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions packages/gatsby-source-contentful/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ You might query for a **single** node inside a component in your `src/components

#### A note about LongText fields

On Contentful, a "Long text" field uses Markdown by default. The field is exposed as an object, while the raw Markdown is exposed as a child node. Except if the content is Markdown-free, you cannot use it as is:
On Contentful, a "Long text" field uses Markdown by default. The field is exposed as an object, while the raw Markdown is exposed as a child node.

```graphql
{
Expand All @@ -248,8 +248,7 @@ On Contentful, a "Long text" field uses Markdown by default. The field is expose
}
}
```

In order to handle the Markdown content, you must use a transformer plugin such as [gatsby-transformer-remark](https://www.gatsbyjs.org/packages/gatsby-transformer-remark/). The transformer will create a childMarkdownRemark on the "Long text" field and expose the generated html as a child node:
Unless the text is Markdown-free, you cannot use the returned value directly. In order to handle the Markdown content, you must use a transformer plugin such as [gatsby-transformer-remark](https://www.gatsbyjs.org/packages/gatsby-transformer-remark/). The transformer will create a childMarkdownRemark on the "Long text" field and expose the generated html as a child node:

```graphql
{
Expand All @@ -263,7 +262,7 @@ In order to handle the Markdown content, you must use a transformer plugin such
}
```

You can then insert the HTML inline in your JSX:
You can then insert the returned HTML inline in your JSX:

```
<div
Expand All @@ -274,8 +273,6 @@ You can then insert the HTML inline in your JSX:
/>
```

While this solution is not ideal, you can alternatively use "Rich text" fields instead of "Long text" in order to avoid the inline html (see below).

#### Duplicated entries

When Contentful pulls the data, all localizations will be pulled. Therefore, if you have a localization active, it will duplicate the entries. Narrow the search by filtering the query with `node_locale` filter:
Expand Down

0 comments on commit 03d85d3

Please sign in to comment.