logo

GatsbyJS - Ignore Folders/Files

Last Updated: 2023-12-06

.gitignore can exclude files from being checked in; how to exclude files from Gatsby site generation? Use ignore in gatsby-config.js:

    {
      resolve: `gatsby-source-filesystem`,
      options: {
        path: `${__dirname}/src/pages`,
        name: "pages",
        ignore: [`**/_draft`]
      }
    },

Then add these 2 plugins to gatsby-configs.js:

{
  resolve: `gatsby-plugin-manifest`,
  options: {
    name: `...`,
    short_name: `...`,
    start_url: `/`,
    background_color: `#ddd`,
    theme_color: `#000000`,
    display: `minimal-ui`,
    icon: `src/images/logo.png`
  }
},
`gatsby-plugin-offline`