-
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
Document linking images to other nodes, onCreateNode
in gatsby-nodes.js
#6112
Comments
onCreateNode
in gatsby-nodes.js
onCreateNode
in gatsby-nodes.js
onCreateNode
in gatsby-nodes.js
onCreateNode
in gatsby-nodes.js
my conclusion is it can't be done. if you are from the future and hoping to do what i did, dont try. just do a |
This may linked to this https://www.gatsbyjs.org/docs/migrating-from-v1-to-v2/#dont-query-nodes-by-id |
Hi @sw-yx what do you mean by
this comment suggest that this is done automaticlly #6041 (comment) |
I cannot for the life of me figure out how to link an image file (with gatsby sharp) to a node I have manually created in I have tried this comment by @pieh: #6041 (comment) I have tried to follow @pieh's comments with every conceivable relative path. It says relative path to your markdown file... but I just have hard-coded JSON in my sourceNodes function. So I've used relative path to the images from the I have also tried these steps: https://freddydumont.com/blog/How-to-source-images-and-data-from-JSON-files-in-Gatsby Can we get some documentation coverage for gatsby recommendation on how to do this basic function of adding nodes? @sw-yx - in the two years since opening this have you come up with a standard solution? |
i no longer remember what this is about lol. but given that i said "it cant be done" 2 years ago i probably stand by that |
Summary
because gatsby processes images separately from the other sources that might depend on those images, it is a very common need to want to link them
onCreateNode
. however the documentation on this is basically in #3608 (and other related issues like #5196, all looking the same). in particular this seems to be the key part:however the
endsWith('>> ImageSharp')
doesn't even seem to be relevant anymore (at least when i tried it) so this also doesn't work.we should document common patterns like this, if not treat them as bugs since it is fairly nasty dx.
Relevant information
this is what i'm doing now:
but i only get the bare minimum data, not imageSharp data:
Environment (if relevant)
The text was updated successfully, but these errors were encountered: