Andy Taylor

Andy Taylor

Use to Create a New Jekyll Post

So simple, so useful. Aaron created a simple shell script—executed with Alfred—that takes a ‘template’ Jekyll post, dates and names it, then moves it to a drafts folder.

I modified it slightly to work for my setup: Typing post post-slug into Alfred instantly opens a new post template in TextMate.

Pair this with my OS X service to insert the current date and time, and the friction is almost completely removed from creating a new post.


Aaron’s post no longer exists. Here’s the shell script:

# copy file and rename by date + query
cp ~/your-site/_posts/ ~/your-site/_posts/"`date '+%Y-%m-%d'`-{query}.md"

# open file with Sublime Text
open $1 -a /Applications/Sublime\ Text\ ~/your-site/_posts/"`date '+%Y-%m-%d'`-{query}.md"

You’ll need to update the path and create with whatever YAML Front Matter you usually use. The script simply copies to the _posts directory and renames it. I now have it open in Sublime Text 2, but you could also change that.

Have a comment? @me on Twitter.