Skip to content

Commit 332543c

Browse files
authored
chore(docs): adjust Contentful Rich Text example codes (#29029)
1 parent 9bcc12c commit 332543c

File tree

1 file changed

+23
-22
lines changed

1 file changed

+23
-22
lines changed

packages/gatsby-source-contentful/README.md

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -363,29 +363,30 @@ Rich Text feature is supported in this source plugin, you can use the following
363363
### Query Rich Text content and references
364364

365365
```graphql
366-
{
367-
allContentfulBlogPost {
368-
edges {
369-
node {
370-
bodyRichText {
371-
raw
372-
references {
373-
... on ContentfulAsset {
374-
contentful_id
375-
fixed(width: 1600) {
376-
width
377-
height
378-
src
379-
srcSet
380-
}
381-
}
382-
... on ContentfulBlogPost {
383-
contentful_id
384-
title
385-
slug
386-
}
366+
query pageQuery($id: String!) {
367+
contentfulBlogPost(id: { eq: $id }) {
368+
title
369+
slug
370+
# This is the rich text field
371+
bodyRichText {
372+
raw
373+
references {
374+
... on ContentfulAsset {
375+
contentful_id
376+
__typename
377+
fixed(width: 1600) {
378+
width
379+
height
380+
src
381+
srcSet
387382
}
388383
}
384+
... on ContentfulBlogPost {
385+
contentful_id
386+
__typename
387+
title
388+
slug
389+
}
389390
}
390391
}
391392
}
@@ -420,7 +421,7 @@ const options = {
420421
},
421422
}
422423

423-
function BlogPostTemplate({ data, pageContext }) {
424+
function BlogPostTemplate({ data }) {
424425
const { bodyRichText } = data.contentfulBlogPost
425426

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

0 commit comments

Comments
 (0)