Jekyll drafts

tips and tricks, jekyll comments edit

I’m glad I moved my blog to GitHub pages (especially after I saw this news) and I’m very happy using Jekyll locally while working on my posts. But as a recent Surface Pro 3 owner (review pending) I thought I could work outside home more often which broached the subject how do I synchronize the posts that are not ready to be published.

So far, I was storing them locally on my machine until they are finished which always posed the risk of losing them as they are the sole copy of the post.

Today I discovered a neat feature of Jekyll to end my local copy problem and making all my posts easily synced to everywhere: _drafts folder

Normally the posts go to _posts folder. Now I keep all incomplete posts under _drafts folder. I can checkin anytime as they don’t go live. And I can still use local Jekyll server by using the –drafts flag such as

bundle exec jekyll serve --drafts

With this flag they are compiled like normal posts which allows me to preview them easily.

Best of both worlds!