pauleychrome

Thanks, Robert, for the Shortcuts help

Big shoutout/kudos to Robert Birming for his prior work, having already largely completed something I was trying to assemble to make posting links to this blog easier.

With limited exceptions (which I'll either work around or ignore EDIT: found my workaround1), my blog posting will be done from Apple equipment, either Mac or iOS. In absence of a JavaScript bookmarklet for Bear to open a new page preloaded with a link to blog about, like I'd seen with WordPress in the past, I poked around at Shortcuts, looking to see if I could build something to call from the iOS (and eventually macOS) share sheet.

The idea was to automatically pass the current URL on to the shortcut, where it could drop it on the clipboard, then open a new tab with the new Bear post page ready to paste in the main box, and I could start working around that to fill in the remaining Markdown and make it look pretty. I was having a little trouble, though, getting the shortcut not to do weird things when it wasn't sure if it was getting a URL, a text string, or (for some weird reason, depending on the whims of the sharing control) the full contents of a page, so I set it aside for a while.

Of course, as in a great many cases, when you're late to the game (as I am with both Bear and Shortcuts), sometimes someone's done the hard work2 for you. Some renewed searching Wednesday evening for new post shortcuts and bookmarks finally led me to Robert's work on Shortcuts for his own Bear Blog. Turns out, I was really close, and — just like HTML and other things on the web — thanks to iCloud publishing of shared Shortcuts, it was incredibly easy to download his shortcut to my own account, modify it a little3, and make it work with my own site here.

Thanks, Robert — this'll make sharing in this new space significantly simpler.


  1. For the rare occasion that I'll be on a Windows system, I tracked down how to make Javascript form the Markdown block, open the posting page in a new tab, and put both into a bookmarklet that does what I'm looking for. I'm likely to use it for the Mac, too, just because it's a few fewer clicks than launching the Shortcut in macOS Safari. The Shortcut is still the best way to tackle it in iOS.

  2. It wasn't that hard, but I haven't been doing a whole lot with Shortcuts until recently, and Bear even more so.

  3. I added an if/then/else (or at least Shortcuts' version of it) to form the Markdown block that gets sent to the clipboard a little differently if there's selected text being sent along, too. I want the selected text to appear in a blockquote below the link, rather than after a colon, and the if/then/else can give me a clipboard string that doesn't include it if it's not needed, so I don't have to remember to remove it.

#articles #blog-meta #shoutout