As I promised last week, let’s see how we can have drafts in our GitHub pages blog instead of posting live and fixing on the fly.
Turns out, once we have Ruby installed, it’s a piece of cake.
Step 1: Install Jekyll:
$ gem install jekyll
Step 2: Go to your website folder and run:
$ bundle install
Step 2.1: If you are using Ruby 3+, you need to add webrick manually:
$ bundle add webrick
Step 3: Run Jekyll with drafts enabled (as per the instructions):
$ bundle exec jekyll serve --drafts
Step 4: Create a draft post in the
_drafts folder and make sure the file name doesn’t include the date, e.g.
Step 5: Go to http://127.0.0.1:4000 and see your draft post in the list.
Once you are ready to go live, move the post over to
_posts and don’t forget to add the date to the file name, e.g.
Much more professional, innit?
P.S. Ideally, I want to be able to send the draft post to a friend to review before publishing. I am not sure that’s possible on GitHub though. Please ping me on Twitter if you know how.