Can content be added without rebuilding in GatsbyJS on Netlify? Discussion of using Contentful and Sanity.io for triggering rebuilds and improving dev experience.

11 replies
Last updated: Apr 26, 2020
Hi, maybe this is a dumb question but I’m wondering if it is possible to add and update content without deploy/building? I’m using GatsbyJS to build my portfolio and hosting on netlify
AI Update

Not a dumb question at all! This is actually one of the most common questions when working with static site generators like Gatsby. Let me break down your options:

The Short Answer: With traditional Gatsby static site generation (SSG), you'll need to rebuild to see content updates. However, there are several approaches to make this seamless or even eliminate rebuilds in some cases.

Your Best Options:

1. Automated Rebuilds with Webhooks (Most Common)

The standard approach is to set up webhooks in Sanity that automatically trigger a Netlify build whenever you publish content changes:

  • Configure a webhook in your Sanity project settings that points to a Netlify build hook URL
  • When you publish/update content in Sanity, it automatically triggers a new build
  • Netlify's Git-based workflow makes this process fast and reliable
  • For a portfolio site, builds typically complete in under a minute

This gives you the benefits of static site generation (speed, security, low cost) while keeping content updates relatively quick.

2. Gatsby's Server-Side Rendering (SSR)

Gatsby v4+ supports SSR using getServerData(), which fetches fresh content on every page request—no rebuild needed. However, there's a significant caveat: Netlify's support for Gatsby SSR is limited. You'll need the @netlify/plugin-gatsby and it only works in production, not during local development.

3. Deferred Static Generation (DSG)

DSG generates pages on-demand when first requested, then caches them. This helps with large sites but doesn't solve the content update problem—you'll still need rebuilds to update existing pages.

4. Client-Side Data Fetching

For specific dynamic sections (like a "latest projects" widget), you can fetch data directly from Sanity's Content Lake API using JavaScript on the client side. The rest of your site remains static.

My Recommendation for Your Portfolio:

Use automated webhooks with Netlify build hooks. It's the most reliable, well-supported approach for Gatsby + Netlify. Here's why:

  • Portfolio sites typically build quickly (seconds to a couple minutes)
  • You get the full benefits of static site generation—excellent performance, security, and SEO
  • Updates are automatic—just publish in Sanity and your site rebuilds
  • Netlify's platform handles this workflow seamlessly with deploy previews and atomic deploys

If you absolutely need instant updates without any build step, you might want to consider Next.js instead, which has much better SSR support and works excellently with both Vercel and Netlify.

Nope, you have to rebuild. You can use netlify deploy hooks so that anytime data is published it triggers a rebuild
With Contentful, there’s a way where you can choose what type of changes can only trigger a web hook. Is that what you’re looking for? Like only publish would deploy/build an app but not necessarily an update or create
Thank you for the answers!
Maybe we should make an example of a netlify function that makes it easy to selectively rebuild on content updates too. I mean, so that people don't need to recommend Contentful here 😛
And maybe a FAQ section? 🙂 Sanity is a great service but it can be a bit confusing to get started
Understandable! The reason we don't have a FAQ section is because we think it's better to structure that information into where it belongs in the documentation. In this case, what was unclear to you? How Gatsby worked as a static site generator? Or what choices you have in triggering a rebuild?
It was the choices to trigger a rebuild 🙂 I found the answer after I played a bit with the templates.
IMO, I think it is better to have an FAQ and link some of the answers to the specific parts in the documentation. Anyhow, I think Sanity is a great service
Gotcha! I'll make sure that we add some more material on hosting and rebuilding on Netlify/Vercel
Didn’t mean to recommend contentful! 😂 Just used it for referenced haha
Not trying to pander but I’ve been using Contentful for a year and I’m never starting a new project there after using Sanity for 2 weeks!

Dev and author experience is soooo much better.
Haha – no worries 🙌

Sanity – Build the way you think, not the way your CMS thinks

Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.

Was this answer helpful?