Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Example of using drafts in Jekyll

Let's say your Jekyll site's directory structure looks like:

|-- _config.yml
|-- _drafts/
|   |--
|-- _layouts/
|   |-- default.html
|-- _posts/
|   |-- 2013-05-10-a-published-post
|-- index.html

How to preview a draft post

Normally (and on GitHub Pages) Jekyll will ignore the posts in the _drafts folder, publishing only the posts in the _posts folder. If you run Jekyll locally with the --drafts flag (e.g., jekyll serve --drafts), Jekyll will include any posts in the _drafts folder, just as if they were published post (but don't worry, only locally).

i would add a / after the folders name to mark the difference between a folder and a file


@pborrell Great idea. Updated. Thanks.

Updated !

TheFox commented Sep 17, 2014

Is there a variable to check if a post is a draft or not? Something like post.draft but without using draft: true in each file.

Now that GitHub Pages are limited to 10 builds per day, is it safe for me to assume that committing to the _drafts folder does not trigger a build?

smutnyleszek commented Mar 25, 2017 edited


It's not 10/day it's 10/h, as you can read at

GitHub Pages sites have a soft limit of 10 builds per hour.

And as for _drafts triggering a build, it doesn't really matter. Every commit to selected branch triggers a build

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment