An (app-agnostic) iOS Shortcut for link-blogging
A couple of weeks ago I mentioned that I was getting back into the habit of sharing interesting links here. Over the years, I’ve come up with, and written up, a number of different ways of pulling info from the web and shoving it into posts I want to share with the world. But this time I wanted to create something I could use entirely inside iOS.
The majority of my actual reading these days happens on my iPhone, via Pocket, Reeder, or a web browser. Because of this, I knew I needed to come up with an iOS Shortcut that would let me push—from anywhere—interesting things to a post of links, and to have the behavior be consistent no matter from which app I invoke it (e.g., Pocket, Chrome, Twitter, etc.).
The Shortcut I developed allows for this consistency, and also takes into account whether I want to share an excerpt from the article, which is governed by whether or not I previously copied some text from the article. And again, it doesn’t matter from which app/site you’re invoking the action in the Share Sheet.
The logic of the Shortcut is pretty straightforward, and likely instantly gleanable from viewing the Shortcut itself, but for completeness’ sake, I thought I’d outline the steps here:
- Receive a URL as an input (from the Share Sheet)
- Pass the title of the received URL to Text Case and convert it to “Sentence Case,” which basically ensures that the first word is the only word capitalized (which means in many cases I’ll need to look at this manually and correct as needed, but in aggregate it saves me a ton of time)
- Convert the title and URL into a Markdown link
- Ask whether the clipboard should be pasted into the to-be-shared text (i.e., did I copy to the clipboard an excerpt from the article that I’d like included when I share?)
- Use iA Writer's URL schemes to push the new link into the target file:
iawriter://write?mode=append&append-location=end&auth-token=Xt9Hx7uHVac3tNRBTZ3N&text=link blob&path=FilePath, where
FilePathpoints to your target file (
/Locations/iCloud/Links.mdin my case)
Unfortunately, iA Writer—my writing app of choice for Mac and iOS—has no Shortcuts support (yet), and so you're left to use URL commands to append to a file, for which you'll need to generate an
auth-token (instructions here). It'll be a similar process for other apps that don't yet support Shortcuts.
Some writing apps have a ton of Shortcuts support, like Ulysses, whereby you can append your new link to the end of a specific file, without ever having to open the app, and can bypass entirely all of the URL stuff. This, of course, is ideal, but on its own it’s not enough for me to switch back from iA Writer (or to any other app that doesn’t yet support that sort of thing).
If interested, you can grab the Shortcut here.