When a user specifies a gatsby-plugin-page-creator plugin with a path pointing to src/pages we replace the config of our default gatsby-plugin-page-creator in gatsby core. This allows people to add ignore options.
A step in the right direction:
1) open https://github.com/gatsbyjs/gatsby/blob/abf888147de0c87d5c8560eaf2de18a0da4b5fca/packages/gatsby/src/bootstrap/load-plugins/load.js
2) find a gatsby-plugin-page-creator plugin with the path pointing to src/pages and temporary save the config in a variable
3) Replace the options on line (https://github.com/gatsbyjs/gatsby/blob/abf888147de0c87d5c8560eaf2de18a0da4b5fca/packages/gatsby/src/bootstrap/load-plugins/load.js#L217) with your variable.
4) write tests to make sure this works correctly.
// in gatsby-config.js
{
plugins: [{
resolve: require.resolve(`gatsby-plugin-page-creator`),
options: {
path: `${__dirname}/src/pages`,
ignore: [`**/examples/**`],
},
}]
}
Should change the default gatsby-plugin-page-creator config in
https://github.com/gatsbyjs/gatsby/blob/abf888147de0c87d5c8560eaf2de18a0da4b5fca/packages/gatsby/src/bootstrap/load-plugins/load.js#L214-L222
Outcome should be
plugins.push(
processPlugin({
resolve: require.resolve(`gatsby-plugin-page-creator`),
options: {
path: slash(path.join(program.directory, `src/pages`)),
ignore: [`**/examples/**`],
},
})
)
We get a lot of requests to override the default gatsby-plugin-page-creator plugin. At this point we don't offer a good solution for this problem, there is a workaround but it's not fixing all use cases.
Hey @wardpeet! I would like to work on this issue.
Nice! Please let us know if we can assist with anything. We suggest opening a draft/WIP PR if you having questions so we can give pointers on specific areas.
Thank you for contributing! ❤️
My PR is failing e2e tests even though all other tests are passing in my local dev environment. Any idea @wardpeet
Fixed and published in [email protected] thanks to @akshayymahajan 🥇
Thanks @sidharthachatterjee @akshayymahajan @wardpeet !
This is working with the following config in my gatsby-config.js (needed to remove the require.resolve from @wardpeet's first description):
{
resolve: `gatsby-plugin-page-creator`,
options: {
path: `${__dirname}/src/pages`,
ignore: [`**/examples/**`],
},
},
@karlhorky We meet again! Put you've got the wrong Sid this time 😛 (you want @sidharthachatterjee)
🤦♂️ Ah oops, sorry Siddharth! Tagged Sidhartha now.