Reputation: 890
I am creating a forum using Gatsby
I have develop a form that users can use to create threads to add to the forum in a page called create.js
which which sends the data to an external DB.
Once, the user has submitted the thread, I want to create a new page using a template, normally I would use in Gatsby-node.js
; according to the Gatsby Docs Gatsby-node.js
is only run once on deployment.
Is there another way that I can access CreatePage()
outside of Gatsby-node.js
or is there another function I am missing?
Ultimately I want the new page to available in the Gatsby application, without redeploying, after the user has created the necessary content.
Upvotes: 0
Views: 99
Reputation: 890
I order to generate pages without using CreatePage
in Gatsby-node.js
, Gatsby advises to use @reach/Router
and matchPage
to extend the client application's router, we call this functionality (Client-only Routes)
more info here
Upvotes: 0
Reputation: 6982
The way Gatsby works is that all pages need to be generated at build time. You cannot add new pages without triggering a new build.
Gatsby is not a suitable platform for a forum since content changes hundreds or thousands of times a day. Gatsby is intended for content that changes infrequently such as blogs (which might update a few times a day).
Upvotes: 1