Gatsby & WordPress - 5.2. Gatsby Node.js Structures
Hey! Just so you know, this article is over 2 years old. Some of the information in it might be outdated, so take it with a grain of salt. I'm not saying it's not worth a read, but don't take everything in it as gospel. If you're curious about something, it never hurts to double-check with a more up-to-date source!
In this video, we explore the Gatsby.node.js file that programmatically generates our Gatsby pages.
We separate each Post type into its own custom asynchronous NodeJS function which will query our internal schema and then map over the JSON results to create our pages.
Originally we did all of this in one large ugly file, at the end of the video we will have a structured file setup for our Gatsby environment which will make it easier to maintain and contribute towards.