Open classiemilio opened 4 years ago
I was able to do this by forking this project, bumping path-to-regexp to version 6.1.0 and using negative lookahead in the match
param for my top-level pages. The version of path-to-regexp this project is currently using doesn't support negative lookaheads. This works for my purposes after bumping that dependency:
pages: [
{
type: 'Page',
match: "/:uid((?!app)[^/]+)",
path: '/preview/page',
component: require.resolve('./src/templates/page.js'),
},
...
I've submitted a pull request bumping that dependency, would appreciate if a maintainer could merge it, thanks!
cc @birkir
I'm trying to use this alongside gatsby-plugin-create-client-paths for a hybrid application with some client-only routes. I'm setting up gatsby-plugin-create-client-paths to treat all routes that match "/app/*" as client paths. However, it seems to not work alongside this plugin if I have any Prismic pages that match "/:uid" (even though none of the pages in my Prismic instance have "app" as their uid). Things work fine if I change my pages to match something else, like "/page/:uid", but I'd prefer to keep the top-level path for my general pages. Is there a way to make this work?
I currently have this in my
gatsby-config.js
for those two plugins (and I've tried switching up their order just in case):