Skip to content

Instantly share code, notes, and snippets.

@czottmann
Created June 4, 2012 20:22
Show Gist options
  • Select an option

  • Save czottmann/2870636 to your computer and use it in GitHub Desktop.

Select an option

Save czottmann/2870636 to your computer and use it in GitHub Desktop.
Draft posts in Jekyll
Loading
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 %}
<li>
<a href="{{ post.url }}">{{ post.title }}</a>
</li>
{% endunless %}
{% endfor %}
@byee01

byee01 commented Jul 25, 2012

Copy link
Copy Markdown

You can just use "published" in the YAML instead.
https://github.com/mojombo/jekyll/wiki/YAML-Front-Matter

@czottmann

Copy link
Copy Markdown
Author

@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.

@byee01

byee01 commented Jul 25, 2012

Copy link
Copy Markdown

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).

@robwierzbowski

Copy link
Copy Markdown

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

@olivierlacan

Copy link
Copy Markdown

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

@davidnormo

Copy link
Copy Markdown

+1 @carlo thanks!

@ahmadajmi

Copy link
Copy Markdown

Thanks @carlo

@suminb

suminb commented Oct 10, 2016

Copy link
Copy Markdown

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