References
I've been trying out ButterCMS with Gatsby for about a week now. It's a pleasure once it's setup, but there are a few hiccups that I found missing in scattered documentation.
to set HTML. If using
upon a page refresh, you'll find an empty page. Instead use the below to set HTML.
<div dangerouslySetInnerHTML={{ __html: body }} />
try {
posts = await graphql(`
{
allButterPost {
edges {
node {
id
seo_title
slug
categories {
name
slug
}
author {
first_name
last_name
email
slug
profile_image
}
body
}
}
}
}
`)
If categories is not populated on ANY blog post on ButterCMS, the GraphQL query will have a cryptic error! Your options are to
In short, after your initial setup, make sure to refresh blog pages after a production deploy. Hopefully you won't run into the same issues I had! Good luck!