You can create a draft post by adding draft: true
to the post's YAML frontmatter
or by putting the post in a _drafts/
directory instead of the _posts/
directory.
Drafts won't appear in post lists (generated by {% raw %}{% include post_list.html %}{% endraw %}
)
by default and won't appear in the site's feed if using the jekyll-feed plugin.
I recommend also adding sitemap: false
and robots: noindex, nofollow
to a
draft post's frontmatter to keep it out of the sitemap and search engines:
---
draft: true
sitemap: false
robots: noindex, nofollow
---
My Draft Post
=============
...
You can render a list of all a site's draft posts by passing drafts=true
to
{% raw %}{% include post_list.html %}{% endraw %}
:
{% raw %}{% include post_list.html drafts=true %}{% endraw %}
This can be used to create a drafts page listing all your draft posts
(remember to put sitemap: false
and robots: noindex, nofollow
in the drafts page's own frontmatter too).
See Post Lists for more on post listings.