Skip to content
Discussion options

You must be logged in to vote

I ended up creating a special image component with a static GraphQL query that source all images in the "folder with images for the sidebar".

I did that by creating a reference to the folder in the gatsby-config file with "gatsby-source-filesystem".

You can then filter by "sourceInstanceName" in the graphQL query directly.

I then add the filename of the image as a prop to the image component. The component then filters through the image-files by name. Kind of "hacky" but I really couldn't figure out how to do this more elegant? I think Gatsby Image is a bit hard to work with for components where data is separated from the component coming from JSON or CMS?

I can't help thinking it should …

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by LarsEjaas
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
1 participant