Miskatonic University Press

Jekyll 2

jekyll emacs

I’ve tweaked a few more things with Jekyll, so, as every Jekyll user seems to do, probably because of the excitement and joy of working with a nice clean new system, I’ll note them down.


I updated the configuration options to turn on SmartyPants in the RedCarpet Markdown converter:

markdown: redcarpet
  extensions: ['smart'] # Turns --- into an em dash, poshes up quotes, etc.

Now it turns

'foo' "bar" yes---no 1914--1918


‘foo’ “bar” yes—no 1914–1918

The dashes are handled the same as in LaTeX and Org, which is how I like it.


You can set a variable date in the front matter of any page or post. In a page, it becomes the last-modified date of the page, which I show at the bottom of each page (for example on /about/). In a post, it overrides the date set by the filename of the post. If you have a post in a file named 2014-01-13-foo.md and set the date variable in the post to 2014-01-10 01:00:00 -0500 then Jekyll will date the file to 10 January 2014, not 13 January.

Because of that, I don’t want timestamps automatically updating on posts. It is possible to have Emacs update time stamps automatically, and I could customize it so it knew that the date line is where I want the timestamp, and I could even customize it with per-directory local variables so it did not do this in _posts but only acted on pages.

I decided that’s too much bother for now. Sometimes I don’t want to show that a page has been updated. So I made a little function (taken from EmacsWiki) I can run when needed:

(defun jekyll-timestamp ()
  "Insert a time stamp suitable for use in a Jekyll page or post.  Replaces current text selection."
  (when (region-active-p) (delete-region (region-beginning) (region-end) ) )
  (insert (format-time-string "%Y-%m-%d %H:%M:%S %z")))

I haven’t bound this to a keystroke, because I don’t think I’ll run it much, and M-x jekTAB is easy to do. The function is defined in setup-jekyll.el in my .emacs.d.


I got this idea from Brett Terpstra, who’s doing much more complicated things. I just added one line to my Makefile for when I publish the site by using rsync to push it all up to my server:

notify-send "Web site is now live"

notify-send makes a notification pop up on my desktop. Now I can run

make publish

then go into another window and do something, and when the site’s been refreshed I’ll see the alert.

I’ve seen alerts pop up, of course, but I didn’t know about this command. Seems like it could be very useful for small hacks.

Markdown for pages

I had some pages written in HTML that were processed by Jekyll and had the templated applied. I wanted to move them to Markdown but the Markdown versions weren’t showing up on my site. It was because I had foo.md and foo.html both in my souce directory. The foo.html must have ended up overwriting the HTML file generated from foo.md. Deleting foo.html fixed it up, and then I had a happy time updating a bunch of pages and converting them to pure Markdown, for example Twists, Slugs and Roscoes: A Glossary of Hardboiled Slang, which I haven’t updated in about a decade.