Fixing Jekyll --watch and 404 errors
When you edit drafts locally, a very handy Jekyll feature is the –watch flag, which triggers Jekyll to rebuild whenever you save your post:
$ bundle exec jekyll serve --drafts --incremental --watch
However, on my Ubuntu 16.04 desktop, this yields erratic 404 errors.
After cursing Jekyll for a few weeks, I decided to dig into it using my favorite tool
strace. And indeed, Jekyll removes the draft after a save. When run with
--verbose, it becomes clear:
Skipping: _drafts/world-domination-howto.md has a future date
I added some debug to
lib/jekyll/readers/post_reader.rb and it appears that the file’s ctime is a few microseconds off from the its mtime. Curious?
A quick fix is to run Jekyll with the
--watch --future option.
A thorough fix probably involves digging into the internals of my ecryptfs home folder (which is a standard Ubuntu feature by the way).