View Jekyll Drafts and Future Posts
How to create a Jekyll draft?
All you have to do is simply create a directory called _drafts in the site’s root and place your draft posts inside.
Avoid including a date in the file name and the front matter for draft posts.
Build Jekyll site locally
To build the Jekyll site locally, one of the two below commands can be used.
jekyll servebundle exec jekyll serve
depending on whether you use Jekyll through Bundler or have it installed directly to the system.
View drafts and future content
- Using the
--draftsflag with the terminal command will allow Jekyll to read the source files under_draftsand build your site. - Using the
--futureflag with the terminal command will allow you to view all posts that are dated in the future. - Without the
--futureflag, all source files dated in the future will be skipped over including those under_drafts- System message →
Skipping: _drafts/2023-09-25-test.md has a future date
- System message →
Code
My current serve command looks like this:
1
bundle exec jekyll s --port 4002 --drafts --future
This post is licensed under CC BY 4.0 by the author.