Creating draft posts with Sculpin

Website Nov 25, 2021

As is so often the case with blog posts, you start writing one and then hit writers block. You want to go away and clear your mind, or do some additional research. No problem!

At least, not if you are using a traditional CMS. Something like Wordpress, or Ghost. They will let you store posts as drafts until you are ready to put them live, or schedule them.

But what if you aren't using a traditional CMS? What if you are using a static site generator (SSG) like I am on my Raspbery Pi blog? I stated before that this is an issue with SSGs. If there is a way, it might not be obvious from within the SSG, so you resort to creating posts in different places and getting frustrated about the whole process.

Fortunately, Sculpin has an easy way of managing this. Sculpin is the static site generator I use for my Pi blog. The method is listed in the documentation, but the use of which might not be obvious at first glance:

Sculpin documentation on how to ignore files

Great. So this directive would ignore all files ending with a ~ e.g. When you generate the site, it would be ignored until the ~ character is removed.

This directive belongs in the app/config/sculpin_kernel.yml file, and can be any pattern. If you wanted to prefix your draft files with draft, then the directive would be:

  ignore: ["**/draft-*"]

Then, when you want to publish a post, remove draft from the file name, and re-build the site.

Actually, it's not just sites it applies to. It can be applied to pages or any other custom content you have.

With that in mind, it suddenly becomes much easier to create draft posts in one place, and not have to worry about accidentally publishing them before you are ready.

I'm sure other SSGs will have similar mechanisms, but this one will certainly help me a lot going forward.


Great! You've successfully subscribed.
Great! Next, complete checkout for full access.
Welcome back! You've successfully signed in.
Success! Your account is fully activated, you now have access to all content.