Blogging with Alfred

I write two blogs using Jekyll: this one and a tips ‘n tricks blog for Formr, so when I need to write a new blog post I don’t want to fool around with finding the folders and creating and naming files with dates and creating YAML front matter and all that jazz, so I have Alfred do it for me with a simple keyword.

Now, when I want to create a new blog I bring up Alfred and type blog: followed by the title of the blog article and then select the blog in which I want to create the file.

Alfred will then create a new file in the appropriate blog directory, name it with today’s date and slug the title so it’s something like: 2015-04-24-a-tribute-to-lederhosen.md, add the correct YAML front matter and then open it in Markdown Pro so I can get to work.


Here’s How

  1. Open Alfred and create a new Blank Workflow.

  2. Add an Keyword Input from the large in the upper-right.

  3. Type in the keyword you want to use to trigger the action, mine is blog: Uncheck the with space checkbox, and make sure Argument Required is selected in the dropdown. The argument is where you’ll type the title of your blog post. Now enter a title and click save.

  4. Now add an Run Script action () and make sure /bin/bash is selected in the Language dropdown.

  5. Copy this Gist and paste it into the Run Script action - replacing Alfred’s default query="{query}" text and editing accordingly. Click save.

  6. Finally, connect the Keyword action to the Run Script action.

  7. Open an Alfred prompt and enter blog:My New Blog

  8. If all went according to plan you should immediately have a new Markdown document staring you in the face!