I have a handful of Automator scripts I’ve created to make maintaining this site with Jekyll just a little easier. The first script let’s me highlight some text on a web page and click a bookmarklet (or, more likely, hit the command+3 key combo), and the script creates a newly formatted Jekyll post with the highlighted text in markdown quoted syntax, and opens it in my default Markdown editor.
Here is how its done.
First, open Automator and create a new application with a single action: “Run Shell Script”. Next, copy and paste this script into the text field:
Note the line beginning
POST_FQN. I have this site locally stored in a dropbox folder named “WebLog”, so you will have to change this line to point at your
_posts folder. The rest should work fine. Save the script as an application somewhere that makes sense and quit Automator.
Next, drag this bookmarklet to your bookmarks bar: Blog This.
The last part is a bit of a hack, but it works well. You will need to let the operating system know that your new Automator app responds to the
blogPost:// url scheme. So, find your Automator application saved from the first step, control-click on it and select
Show Package Contents. In the new Finder window that opens, open the
Contents folder and find the file named
Info.plist. Right click on that file and open it using your favorite plain text editor, something like MacVim or TextEdit.
Find these two lines:
<key>CFBundleIdentifier</key> <string>com.apple.automator.Post From Safari</string>
And add this directly underneath:
<key>CFBundleURLTypes</key> <array> <dict> <key>CFBundleURLName</key> <string>Post to Blog</string> <key>CFBundleURLSchemes</key> <array> <string>blogPost</string> </array> </dict> </array>
Save the Info.plist file and close the Finder window. You should be all set. Highlight something on this page and click the bookmarklet.