Obsidian - Moving a note breaks the hook link

Pretty much what the subject says - I am finding that when I move an Obsidian note to a new folder, all of the hook links break and the note is no longer linked.

I was using it extensively with the daily note plugin, then I move my daily note to another folder at the end of the day. If I activate hook in that new location, none of the links show.

Am I missing something?

That is a drag, Craig.

As noted on Using Hook with Obsidian – Hook:

The current integration of Hook with Obsidian makes use of obsidian:// links

rather than hook://file/ URLs. (We go to some lengths to ensure that hook://file/ URLs can cope with the movement of the files to which they refer, and even further.)

as background: When you use the Copy Link command, Hook returns a URL that has a “scheme”. The scheme depends on the app and how Hook interacts with the app. We have documented the Principles That Determine the URL Scheme Returned by Copy Link for a Given App . Generally, if an app defines its own URL scheme,that is what Copy Link and Copy Markdown Link link will return. For instance, in DEVONthink, hook returns x-devonthink-item URLs by default. In OmniFocus, you get OmniFocus:// URLs. In Obsidian you get obsidian:// links. In web browsers you tend to get http:// or https:// URLs.

App developers are implicitly responsible for doing their best to ensure their URLs remain valid. Hook cannot guarantee the integrity of URLs of third party apps (as implied on the apps page). For instance, if you copy a link to a website, and the website developer changes the URL for that resource, then the link will break. However, I would be very surprised if the URLs served by established apps like DEVONthink, OmniFocus and the like were to break. we ourselves do our best to maintain the validity of the URLs (hook://file/, etc.) we define.

In any event, I have updated Using Hook with Obsidian – Hook to note this issue.

The issue warrants a bug report with Obsidian. (I recall doing some tests, and thought I had tested renaming of files, but my notes are sketchy on that. I would have thought that brittle links would be quickly discovered by Obsidian users. So perhaps this is a recent bug.) Meanwhile, I would recommend if you can, re-establishing the previous directory structure, until Obsidian rectifies the issue, assuming they will. On the Linkable Mac Apps – Hook we list Obsidian as: “:thinking: Obsidian”, linking that entry to Using Hook with Obsidian – Hook. There we note that Obsidian is still beta software.

1 Like

I got in touch with one of the co-founders about this. However, I would recommend discussing on their forum or discord service. The community there will be able to help.

Looking at the obsidian:// URLs again, I am reminded that they code a relative pathname without an ID that might be used for tracking.

We used to have a liaison between Obsidian and Hook communities. (that’s an informal volunteer role.) If an avid Obsidian + Hook user wants to take up that role, that would be particularly appreciated given that Obsidian is still in Beta and moving fast.

1 Like

Thank you @LucB for addressing this. Yes, I confirmed that the Hook links use the relative pathname (as I was trying to build a Keyboard Maestro script to open a created Obsidian file as well) and not only do the hook links break, but a regular link to the Obsidian note pasted in an Omnifocus task also breaks for that reason.

It definitely sheds some light on if Obsidian will be able to be a permanent use in this situation.

I posted at the Obsidian forum as well. Obsidian Links when you rename a file Hook breaks (actually, all of them seem to break) - Feature requests - Obsidian Forum

The Hook scripting could be changed to fallback to opening the note name (Obsidian will find best match path) if opening the absolute path fails, but that doesn’t seem a good solution to me.

1 Like

There’s a suggested workaround here, but not a great one.

Is it maybe possible that hook support the Advanced URI Plugin?
There is one problem in using this plugin. If you invoke hook in Obsidian, you invoke the default URI and not the Advanced URI