Menu

Why Publishing in Sanity Didn’t Update Our Gatsby Site
📰

Why Publishing in Sanity Didn’t Update Our Gatsby Site

DEV Community: gatsby·Diogo Oliveira·11 days ago
#YjiaZBm7
#devtogatsby#devto#dev#sanity#production
Reading 0:00
15s threshold

I recently updated an article on the RankingPT blog. The revised text was published in Sanity, but the live website still showed the old wording and was missing a new link.

The article’s URL returned 200. There was no obvious error page. The content was simply out of date.

The missing step

Our site uses Sanity for content, Gatsby to generate pages, and Netlify to host them. Publishing in Sanity updates the content available to Gatsby. It does not, by itself, replace the HTML that Gatsby generated during the previous production build.

In development, our Gatsby configuration watches for Sanity changes. That watch mode is disabled for production. The live article therefore keeps showing the version captured by the last build until a new build runs.

The sequence we needed was:

Publish the article in Sanity.

Run a new production build that reads the published content.

Publish the resulting Gatsby pages through Netlify.

We had completed step one.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.