Closed signalwerk closed 5 years ago
index.js
(and any page created by the page creator plugin) is achievable by using another instance of the page creator plugin in the theme as seen in this commit I just pushed. The important part of the config is that the instance of the page creator plugin points at the theme's src/pages instead of the site's.
// theme's gatsby-config
{
resolve: `gatsby-plugin-page-creator`,
options: {
path: require.resolve(`./src/pages`),
},
},
You can also use the same approach for markdown pages, etc. (adding another instance of the relevant plugin, such as the filesystem source.
For 404s, the situation seems a bit more complicated and I'm not sure why the theme's 404 isn't showing up. There are two internal plugins for handling development and production 404s which I didn't see an obvious reason in. We'll have to look into this a bit more.
It seems this doesn't work anymore? I added the plugin like in your commit, but the pages don't get created.
@pgegenfurtner can you be more specific? which pages don't get created, how is your config set up, etc.
It was a wrong config on my side. My theme is extracted into a npm package.
{
resolve: `gatsby-plugin-page-creator`,
options: {
path: require.resolve(`/src/pages`),
},
},
didn't work. If I point the path to the theme page directory via
{
resolve: `gatsby-plugin-page-creator`,
options: {
path: (`${__dirname}/src/pages`),
},
},
it works.
@ChristopherBiscardi - how do you feel about closing this issue? Looks like it has been resolved?
yep, closing. Thanks for the ping :)
Is there a way to get
index.js
and404.js
from the theme