Configure application to use dynamic pages with Gatsby

Hi all,

What are you trying to accomplish
Currently I have a simple setup by using gatsby-starter-builder. I understand these concepts

  • In order to create Pages/ Sections we need to have models.
  • And in order to edit these pages that we created we need to have our source setup over cloud or locally (I have setup my source locally. localhost:8000 serves the application with using correct API key).
  • And I have physical page for each page that I have created in web editor under src/pages/.

So far the pages that I have created are linked and working properly. I even have some custom components setup and ready to use inside the builder.

My question - Is there a way for us to create new pages with different URL’s but maintaining the same host in the Editor? And not have to manually create a physical copy in my source for each page I’m making on Editor side. Because once I set this up I want other non technical colleagues to do the page creation as that is the whole point.

Please let me know if im missing something. Thanks in advance.

Hi @shehan, welcome to the forum! Yes, once you configure the @builder.io/gatsby plugin it sets up dynamic routing so that whenever users create new pages in their Builder.io account your Gatsby app will find it. You can add multiple templates to the plugin if you have several page models. The template names are the camel cased version of your Builder page model names. Here is a short recording demonstrating this. Please let me know if you still have any questions.

Hey @ancheetah Thank you for this informative response. That cleared out a lot for me. One question though. Each time we make any change to a page or a section we have to restart the server ? Because my idea is to have this hosted remotely and let couple of other people handle content there. They wont have access to do any restarting of the server.

Hi @shehan since Gatsby generates static HTML at build time you do need to start a new build when additional pages are created in Builder. You can deploy your site to a platform like Netlify or Vercel for CI/CD then create a webhook that will automatically trigger builds every time new content is published from your users in Builder.

https://www.builder.io/c/docs/webhooks
https://forum.builder.io/t/integrate-builder-with-your-netlify-site-using-a-webhook/1238
https://forum.builder.io/t/avoid-having-to-stop-and-start-gatsbyjs-development-server-to-get-changes-from-builder-io/163

Hi @ancheetah got it. Thanks :blush:

1 Like