Andy Taylor

Andy Taylor

Use Alfred.app 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.

Update

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

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

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

You’ll need to update the path and create template.md with whatever YAML Front Matter you usually use. The script simply copies template.md 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.