Perhaps, like me, you use Jekyll to compile your blog, in which case each of your posts will be in the form of a Markdown file in a _posts folder somewhere. In that case, there's probably been a time when you were reading one of your own posts in Safari, noticed a spelling mistake and wanted to go and edit the Markdown file for that post. For situations like that, I've come up with a little Alfred extension to open the Markdown file for the currently displayed post in Safari.

Basically, the extension is an Applescript which grabs the current URL from Safari and chops it down to the /yyyy/mm/dd/post-title part, then turns that into a filename and opens that file in your chosen Markdown editor. You can download it by clicking here.

Once you've downloaded the extension, just double-click it to install it in Alfred. Then, there are a couple of things you need to change at the top of the script. First, change the set thePostLocation to "Macintosh HD:Users:Josh:Dropbox:Random-Ramblings:_posts" to point to wherever your Jekyll _posts folder is (remember to use the : character instead of slashes in the file path).

Next, change set theWebsiteAddress to "http://www.joshsunshine.me.uk" so that your blog's address is there in place of mine. If your blog is at http://something.com/blog, add in the /blog part, for example.

Finally, change set theFileExtension to "md" and make it use the file extension your blog posts use. (Markdown posts can be .md, .markdown, and possibly others, so yours may be different to mine).

Once you've changed those three things, you can test the extension by opening one of your blog posts in Safari, then run the post command using Alfred. Happy editing!