Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(docs): adjust Contentful Rich Text example codes #29029

Merged
merged 1 commit into from
Jan 14, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 23 additions & 22 deletions packages/gatsby-source-contentful/README.md
Original file line number Diff line number Diff line change
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