Closed cyrfer closed 5 years ago
Hiya!
This issue has gone quiet. Spooky quiet. 👻
We get a lot of issues, so we currently close issues after 30 days of inactivity. It’s been at least 20 days since the last update here.
If we missed this issue or if you want to keep it open, please reply here. You can also add the label "not stale" to keep this issue open!
Thanks for being a part of the Gatsby community! 💪💜
Hey again!
It’s been 30 days since anything happened on this issue, so our friendly neighborhood robot (that’s me!) is going to close it.
Please keep in mind that I’m only a robot, so if I’ve closed this issue in error, I’m HUMAN_EMOTION_SORRY
. Please feel free to reopen this issue or create a new one if you need anything else.
Thanks again for being part of the Gatsby community!
Summary
How can I use file paths from page data query to render a list of components with unique images?
All the examples I can find assume a hard-coded path in the graphql for the image file, e.g. https://github.com/gatsbyjs/gatsby/blob/master/examples/using-gatsby-image/src/pages/index.js#L109 and this: https://codebushi.com/using-gatsby-image/
Relevant information
I want to have an image in each product component. I want to benefit from Gatsby's offline processing using the gatsby-image
<Img >
component.My data looks like this:
I use the json transformer plugin to get my data from a static json file. I can
.map
over an array of product objects to make a list of components appear. I do not know how to use the Img component with my data.I think I need to know how to do a different kind of GraphQL query other than a StaticQuery.
Here is my page code:
Environment (if relevant)
System: OS: macOS High Sierra 10.13.6 CPU: (8) x64 Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz Shell: 3.2.57 - /bin/bash Binaries: Node: 11.8.0 - ~/.nvm/versions/node/v11.8.0/bin/node npm: 6.5.0 - ~/.nvm/versions/node/v11.8.0/bin/npm Languages: Python: 2.7.10 - /usr/bin/python Browsers: Chrome: 72.0.3626.109 Safari: 12.0.1 npmPackages: gatsby: ^2.1.17 => 2.1.17 gatsby-image: ^2.0.29 => 2.0.29 gatsby-plugin-manifest: ^2.0.19 => 2.0.19 gatsby-plugin-offline: ^2.0.24 => 2.0.24 gatsby-plugin-react-helmet: ^3.0.6 => 3.0.6 gatsby-plugin-sharp: ^2.0.22 => 2.0.22 gatsby-source-filesystem: ^2.0.22 => 2.0.22 gatsby-transformer-json: ^2.1.8 => 2.1.8 gatsby-transformer-sharp: ^2.1.14 => 2.1.14
File contents (if changed)
gatsby-config.js
:package.json
: N/Agatsby-node.js
: N/Agatsby-browser.js
: N/Agatsby-ssr.js
: N/A