Skip to content

Commit

Permalink
chore(docs): adjust Contentful Rich Text example codes (#29029)
Browse files Browse the repository at this point in the history
  • Loading branch information
axe312ger committed Jan 14, 2021
1 parent 9bcc12c commit 332543c
Showing 1 changed file with 23 additions and 22 deletions.
45 changes: 23 additions & 22 deletions packages/gatsby-source-contentful/README.md
Expand Up @@ -363,29 +363,30 @@ Rich Text feature is supported in this source plugin, you can use the following
### Query Rich Text content and references

```graphql
{
allContentfulBlogPost {
edges {
node {
bodyRichText {
raw
references {
... on ContentfulAsset {
contentful_id
fixed(width: 1600) {
width
height
src
srcSet
}
}
... on ContentfulBlogPost {
contentful_id
title
slug
}
query pageQuery($id: String!) {
contentfulBlogPost(id: { eq: $id }) {
title
slug
# This is the rich text field
bodyRichText {
raw
references {
... on ContentfulAsset {
contentful_id
__typename
fixed(width: 1600) {
width
height
src
srcSet
}
}
... on ContentfulBlogPost {
contentful_id
__typename
title
slug
}
}
}
}
Expand Down Expand Up @@ -420,7 +421,7 @@ const options = {
},
}

function BlogPostTemplate({ data, pageContext }) {
function BlogPostTemplate({ data }) {
const { bodyRichText } = data.contentfulBlogPost

return <div>{bodyRichText && renderRichText(richTextField, options)}</div>
Expand Down

0 comments on commit 332543c

Please sign in to comment.