1

I am new to JAMStack and Static Site Generators, lately trying to setup a new blog using Gatsby and github pages. One information I am unable to find(maybe because it's a silly one) in the ocean of all the great Gatsby tutorial is that to add a new blog article/post to my Gatsby site whether I have to rebuild my site each time or just adding a commit containing the new markdown file to my repo will do the job.

piedpipr
  • 155
  • 2
  • 7

2 Answers2

1

In Gatsby (and the Jamstack) you usually have to rebuild the generated HTML when content is added or changes.

Gatsby uses your Markdown files to generate all the HTML pages. If you're planning to keep the content in Markdown files on GitHub you have to either trigger a new build manually or set up a GitHub action to rebuild the GitHub pages.

Quick googling brought up this plugin (didn't test it though).

stefan judis
  • 3,416
  • 14
  • 22
1

Do I have to build my static Gatsby blog each time I add a new markdown blog post ?

Yes, by default.

This is because Gatsby and GraphQL need to create a new node from the new data (or if you have removed it, uploaded it, etc) so your application won't be aware of new data changes unless your build it again.

That said, there are many ways of making this process automatically, mostly, using webhooks or actions. You don't need to use Gatsby Cloud to create a webhook, most of the CMS has integrated this process automated or is easy to achieve.

Ferran Buireu
  • 28,630
  • 6
  • 39
  • 67