olavea / gatsby-theme-picture-book

Create a Do-It-Yourself picture book together with a child you know.
https://petra-rabbit.netlify.com
8 stars 2 forks source link

Filter out audio files from all files #5

Closed raae closed 5 years ago

raae commented 5 years ago

Update the GraphQL query used createPages to include only the image files.

{
  allFile(filter: {sourceInstanceName: {eq: "images"}}) {
    edges {
      node {
        name
      }
    }
  }
}

The "images" in the query above refers to the name in the code below from gatsby-config.js.

{
      resolve: `gatsby-source-filesystem`,
      options: {
        name: `images`,
        path: `${__dirname}/content/ChildrensPictureBookImages/`,
      },
    },
raae commented 5 years ago

When doing this also remove all ignore: stuff in gatsby-config.js.

And only have two gatsby-source-filesystem. One for the audio folder and one for the images folder.

raae commented 5 years ago

Also, do not use fun query names like lillyJoanQuery. They should be descriptive. In this case, it could be allImageFiles.

olavea commented 5 years ago

😸 👍