Skip to content

Instantly share code, notes, and snippets.

Created June 4, 2012 20:22
  • Star 20 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Draft posts in Jekyll
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
{% for post in site.posts %}
{% unless post.draft %}
<a href="{{ post.url }}">{{ post.title }}</a>
{% endunless %}
{% endfor %}
Copy link

byee01 commented Jul 25, 2012

You can just use "published" in the YAML instead.

Copy link

@byee01: But then the actual article isn't rendered at all. My way just hides it from overview/list pages, but you can still visit the page if you know the link.

Copy link

byee01 commented Jul 25, 2012

That makes sense. Just terminology, I suppose. It's more of a "private" or "hidden" post (publicly viewable, but only if you know the url).

Copy link

FYI, rendered drafts are going to be included in Jekyll 1.0. You can check them out in the master branch right now.

Copy link

This is actually a much more flexible and elegant solution. Thanks @carlo.

Copy link

+1 @carlo thanks!

Copy link

Thanks @carlo

Copy link

suminb commented Oct 10, 2016

This is what I was looking for. Thanks.

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