Difference between using gatsby-node.js & plugins options for building pages dynamically

Hi everyone!

First and foremost, I would like to thank the people at Prismic for creating such a product and opening a free plan for developers!
So my question is what’s the difference between creating pages dynamically using gatsby-node.js and using ‘gatsby-source-prismic-graphql’ plugin options?

For context here is the approach using the plugin options: Building pages dynamically
Here is another approach using ‘gatsby-node.js’: Creating pages with gatsby-node.js

Thanks!

1 Like

Hello Lance and welcome to the Prismic community forum!

The differences are:

With the gatsby-source-prismic-graphql plugin pages are dynamically generated inside the src/templates folder, and the necessary data for the queries is provided by the plugin as well as the URL slugs.

And the gatsby-node.js file is the traditional Gatsby way of programmatically create pages from data. It requires a little bit more configuration like using the onCreateNode method for the URL slugs, and createPages for creating the pages.

That’s why we recommend using the gatsby-source-prismic-graphql plugin configuration instead!

1 Like