Publishing to a Hugo Blog using Alfred

Publishing a new post to this (Hugo) blog is easy, but involves too many steps. First, I have to create the file, then open it in my editor, like this:

$ hugo new post/2015/

$ vi post/2015/

Then in my editor I have to edit the title using proper case, etc. Not bad, but I can’t think of any reason it wouldn’t at least open the file in my editor as part of the “new” command. Oh well, since this is all based around the command line and text files it should be easy to make that happen.

I don’t get the same charge out of writing scripts as I used to, so I looked around to see what others might have done. I found this post by Amit Jain explaining how he solves the same problem (but using Jekyll rather than Hugo). In his post he links to a handy Alfred workflow. I modified it to work with Hugo. This has made posting to Hugo even easier.