-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
[gatsby-source-contentful] odd nesting of "LongText" field types... #3205
Comments
This is deliberate — long text fields are markdown so to be able to easily compile those, this field type is created as a child node so then gatsby-transformer-remark can compile it to HTML e.g.
The source plugins still exposes the raw markdown but generally you'd want to use the transformed HTML as in the above code sample. |
@KyleAMathews - it would make good sense to add this information into https://www.npmjs.com/package/gatsby-source-contentful and the Gatsby 2.0 docs. This took me hours to figure out. |
@jserrao that'd be great! Sorry it took so long! Could you out together a small PR for the readme explaining the difference? |
@KyleAMathews - sure, can do. What's the appetite for me putting together something like the WordPress plugin tutorial, but for Contentful? I've learned a lot of little things building a Gatsby/Contentful site over the past couple weeks. |
@KyleAMathews - PR is ready to go: #7533 |
…by-transformer-remark As shown here: #3205 (comment) you cannot simply do ```{ body{ body} } since the body will be raw markdown, which is not html
…former (#20398) * fix[gatsby-source-contentful] Contentful LongText fields require gatsby-transformer-remark As shown here: #3205 (comment) you cannot simply do ```{ body{ body} } since the body will be raw markdown, which is not html * Update README.md * Update packages/gatsby-source-contentful/README.md Co-Authored-By: Vladimir Razuvaev <[email protected]> * Rewrite for explaining the logic and add clarity The text might not be perfect but it clearly explains what happens. Feel free to reuse it or change it. * typo * mention rich text as an alternative * chore: format * typo and polishing * chore: format Co-authored-by: Vladimir Razuvaev <[email protected]> Co-authored-by: GatsbyJS Bot <[email protected]>
Description
hi there 👋 thanks for the awesome lib! 👏👍
something i ran in to recently: i'm getting oddly nested / awkward graphQL data - ex:
node.title.title
(vs.node.title
) after syncing with the contentful API.Environment
Gatsby version: v1.9.127
Node.js version: v8.9.3
Operating System: macOS 10.12.6
Actual result
given an api response from https://cdn.contentful.com like:
}
and a graphQL query like:
i end up with data like:
note the difference between the name and title fields. in contentful, "name" is a
ShortText
field while "title" isLongText
Expected behavior
ideally, both "name" and "title would be represented in the same way - that is, like the "name" data, un-nested (instead of
node.title.title
, just plain oldnode.title
)Steps to reproduce
1. configure
gatsby-source-contentful
to point to a recently populated space & content model2. run
gatsby develop
3. visit http://localhost:8000/___graphql and query your data
The text was updated successfully, but these errors were encountered: