Thanks to Blogging with Emacs Org-mode and Jekyll my Emacs and Jekyll integration is much better—even though I’m not using Org. I’m still just using plain old Markdown to write things. I use Org for everything else, so I may convert, but for now it’s all working nicely.
If I want to draft a new post, somehow I need to:
- create a new file in
~/web/_drafts/
- with a title of my choosing, which will become the filename
- put the YAML front matter into it
- write in it
I could do all that by hand the hard way, sure, but it seems like something nice for Emacs to automate. And now it does! I hit C-c j n
(C-c
is for local commands, j
means Jekyll, n
means new post), Emacs asks me for a post title, and it creates a draft post for me.
Here’s the Lisp stuff that makes this part of things work. This is what Emacs config files look like.
When I’m ready to post the draft, I hit C-c j p
while I’m editing it, and Emacs gets it ready for publication by renaming the file to include the datestamp and moving it to ~/web/_posts/
.
All of the code is in setup-jekyll.el from my .emacs.d.
Being able to do all this from within Emacs is just what I wanted. Beautiful!