prismicio / gatsby-source-prismic-graphql

Gatsby source plugin for Prismic GraphQL
MIT License
17 stars 14 forks source link

QUESTION/HELP: Using extraPageFields to create URL #47

Closed jodiedoubleday closed 4 years ago

jodiedoubleday commented 4 years ago

I'm looking at adding categories in my page structure, which the user can set in Prismic, for example: www.fruit.com/apple/granny-smith.

The UID of the page is set to 'granny-smith' and I've created a new field in Prismic called 'category'

Looking at the documentation I know you can filter using extraPageFields but can you use this to generate the page structure.

for example:


extraPageFields: 'category',
pages: [{
          type: 'Page',
          match: '/:category/:uid',
          component: require.resolve('./src/templates/page.jsx'),
}]
jodiedoubleday commented 4 years ago

This could be related to https://github.com/prismicio/gatsby-source-prismic-graphql/pull/38, if it is, then feel free to close.