iOS Shortcut: Create Markdown link from URL with auto title

Hi!

I’ve created and have been using an iOS shortcut that can be used either from the Share Sheet when viewing a web page in your browser, or run directly to convert a website URL into a markdown link that can be pasted directly into Obsidian.

This Shortcut makes use of the Get title of URL action provided by the iOS app ‎Actions. This app must be installed on your device in order for the Shortcut to work. (I’m not affiliated with this app or its dev in any way.)

Download Shortcut: URL ➜ Markdown link

What does this shortcut do?

  • When run from the Share Sheet:
    • Captures URL passed via the Share Sheet.
  • When run directly:
    • Captures URL from the clipboard.
  • Verifies URL syntax is valid.
  • Grabs the title of the webpage at the provided URL.
    • If the Shortcut can’t find the webpage title, the user is prompted to provide one.
  • Constructs a Markdown-formatted link, removing extraneous whitespace from the link title.
  • Copies the constructed Markdown link to your clipboard and shows a notification once complete.

This has been working for me quite well - however I would be open to any feedback. I hope someone may find this as useful as I do!

2 Likes

Thanks for sharing this! I’ve had the same functionality as a bookmarklet on desktop for ages but couldn’t figure out how to do this on iOS. Your shortcut works wonders!

This works great! I bookmark a lot of YouTube videos and use the plugin Auto Link Title. This works pretty well for most URLs but fails to capture the title on YouTube because of YouTube’s design. Your shortcut works great and is pretty much instantaneous! Thanks.

@juhis @davidrsim

Thank you so much for the kind words.

If you do find the Shortcut behaving in any way that’s less than ideal, causing any friction in the process of capturing/converting the URL or even have a suggestion for an enhancement - please let me know and I’ll do my best to make it better!

I’m just pleased someone else finds it useful!

The Shortcut has been updated; this means the link shared in the original post has changed. I’ve provided it again here to save the effort of scrolling up.

I realised that although the Shortcut used regex to cut out any trailing whitespace that found its way into the MD link title, any extra whitespace at the beginning of the MD link title was left to its own devices.

Henceforth, extra whitespace found at the beginning or end of the MD link title will no longer be permitted.

If you do run the Shortcut where the link title cannot be auto-generated, you still have the option of leaving the title blank without the Shortcut throwing an error. This gives you the option of pasting the link with a blank title and filling it in later.

2 Likes

Thanks for making the shortcut, works great!