Obsidian - Moving a note breaks the hook link

I prefer obsidian:// links over hook:// links, because the first open in Obsidian, and the second do not; they open files in the default Markdown editor, which cannot be Obsidian, AFAIK.

I do no like the default obsidian://hook-get-address script much because it uses the macOS clipboard, and I’m not in favor of installing extra plugins, like the Advanced URI plugin.

So, I had a go of my own at solving this.

The solution I implemented works without the clipboard, generates fairly stable obsidian:// URLs, and is quite a bit faster than the built-in script. Caveats:

  • Document names are considered to be unique within a single vault. i.e. there’s only one document called “Foo”. For me, that is always the case. I use folders, but sparingly. I never create two documents with the same name in different folders.
  • Moving documents within the vault does not break their URLs. Renaming them does, however. I can live with that, for now.
  • I implemented the necessary logic in Ruby, because I’m not good at AppleScript. Nor do I want to be.

Here’s the gist..

You will definitely need to modify it to accomodate your own situation - especially the paths to the Ruby interpreter and the script itself need fixing - but hey, maybe it’s of use.

1 Like