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
-
Open Alfred and create a new Blank Workflow.
-
Add an
Keyword Input
from the large in the upper-right. -
Type in the keyword you want to use to trigger the action, mine is
blog:
Uncheck thewith space
checkbox, and make sureArgument 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. -
Now add an
Run Script
action () and make sure/bin/bash
is selected in the Language dropdown. -
Copy this Gist and paste it into the
Run Script
action - replacing Alfred’s defaultquery="{query}"
text and editing accordingly. Click save. -
Finally, connect the
Keyword
action to theRun Script
action. -
Open an Alfred prompt and enter
blog:My New Blog
-
If all went according to plan you should immediately have a new Markdown document staring you in the face!