Pursuit of Loot

Draft posts and Gatsby

Posted on 4th January 2020


Out of the box, Gatsby doesn't offer any kind of draft post support, but if you're using markdown files and a transformer to make your blogs posts and like me, find yourself wanting to work on a post over a couple of days, rather than having a special folder outside of your src directory (or wherever it is you've configured gatsby-source-filesystem you might want to instead setup the ability to use a "draft" or "published" attribute in your front-matter.

I couldn't find anything in the gatsby docs, but there were plenty of google results with varying solutions. The one I ended up implementing was this one from Geekscred.

The tutorial was simple enough to follow along, and it helped me understand a little bit more graphql, so that's a bonus. The only part I didn't implement was the bit about RSS feeds, as I haven't configured my site to do this yet (sorry SEO land). That's just one more thing on the #100DaysOfGatsby to-do list.

Enjoyed this post? Feel free to share it with your audience using the links below:

Don't see your favourite social network on the list? Feel free to let me know and I'll get it added.


©2022 Pursuit of Loot. All rights reserved.