UUID for note links in URL scheme

For base32-encoding, I’m currently using AFBase32. And, for manual conversions in my text editor, I’m using a similar Perl module. I’m also aware of a Ruby library but I haven’t tried that. An example screenshot with these IDs in use can be seen here.

To workaround the potential issue of breaking Obsidian URLs, it might be an option for a tool or plugin to specify a separate URL scheme (or amend the current URL scheme), then use this (together with the note ID from the note’s metadata) for external URLs. The resolver would then need to either transform to standard Obsidian URLs, or resolve the note itself directly.

Hi, we can use URI’s to open a note, make a new note, search, but I am concerned for longer lasting links. For example I have a note in my vault called “Project X Reference” and I link outside of obsidian to open this note for my project stuff;

obsidian://open?vault=my%20vault&file=Project%20X%20Reference

This might be a long lived note, and at one point I change the title, because I either split up the project in multiple sub-projects, or I change the title from “Vacation” to “Krete Vacation 2021”. In that case the obsidian URI is broken. I have to know where I left it to restore the link.

I want to propose linking to a YAML ID inside the note, or can even be in the Alias YAML metadata where there is a static ID, or generated ID (like a UUID)

The note will be:

---
id: 7cf7f411-28a8-43e2-85e3-6da816fc2afd
---

# Vacation Krete 2021

Where I can refer to the static generated obsidian ID. That way longer lived notes that are referenced outside of the obsidian vault, will not break.

Als for the URI scheme, maybe something like;

obsidian://open?vault=my%20vault&id=7cf7f411-28a8-43e2-85e3-6da816fc2afd

For now I need to be mindful that I do not change titles too much if for example URI’s are shared, or I need to tag a label somewhere that I know it is a static reference, but it would be awesome if obsidian can be robust enough to reference longer lasting notes that might travel and change titles a few times.

4 Likes

Thanks Jorg, but using YAML for the UUID was already proposed many times above. Glad to see that you’re also in agreement!

@thomaskern Can I suggest you edit your OP and/or the title to include the suggestion to use YAML for the UUID?

3 Likes

Hi,
My post was merged from a separate request so I didn’t see this. But I am glad there is a consensus :wink:

  • Jorgen
2 Likes

Looking at the way that Obsidian links work - the reference in the Obisdian URL is to a relative pathname. If you rename the Obsidian note (or move it, or re-name the folder), the link breaks.

This impacted my use of Hook, but also something as simple as posting a link to an Obsidian note into an Omnifocus task.

Any thought on using a Unique ID to craft these links, so that the note will maintain the same link?

5 Likes

I second this request. Currently, I try very hard to never move an Obsidian .md file, but it’s frustrating to not be able to reorganize as my Vault grows. I’m a big Hook user.

5 Likes

Use case or problem

Obsidian has an internal link looks like obsidian://open?vault=Test&file=Text.
It is not a good idea to made links name-dependent because:
Page can be with typo
Page can be renamed

In this case we can’t get access to page from another program and inside links that was made in plugins (like Katex).

Proposed solution

Solution 1. Create a link with note hash that will be permanent and use a table hash - name. Once name will be changed nothing happened.
Solution 2. Find and replace all text in all notes - find: obsidian://old_name – replace: obsidian://new_name.

Current workaround

Find and replace text in 3d party program.

1 Like

Asked by @moberaptor to create a plugin that will create and open UID notes by UID.
Currently, it only opens notes by UID. In the future would like the ability to generate those UID for your notes.

EDIT
Now I think what I can allow open any note using any frontmatter field(s) and not only id

9 Likes

Hi!.. what would be convenient UUID schemes to our notes, looking into publishing them in the WWW in the future?

I didn’t use the plugin since i can not find it from the community list.

Imho the note’s id should be auto generated, unique, and implemented in frontmatter as discussed.

But may I suggest to use nano-id instead of uuid?

And i also like the idea of using note’s id for the url of notes in Obsidian Publish beside of obsidian-uri. This will make the url of notes unaffected by the change of note’s name

I just ran into this issue when trying to store Obsidian URLs in my task manager, and I immediately realized that would be extremely fragile, especially for work in progress that’s likely to be refactored (files moved, renamed, etc.). Obsidian should store a UUID in YAML frontmatter and use that ID for the URL. Glad to see it’s already being discussed.

2 Likes

I think what you are looking for is the Advanced-URI plugin. It supports adding the uid field automatically.

5 Likes

Hi! I am using Advanced-URI as you suggested. Thanks.

Is there a way to copy the UUID in YAML with a keyboard shortcut ?

I also pose this question in How to set a shortcut to copy the value of a specific key in YAML front matter?

1 Like

It would be nice to have external links that magically work everywhere and don’t rely on any app-specific functionality but I feel we are looking for a complex solution for a rather simple problem here.

There is an easy 100% bulletproof way to refer an Obsidian note in any app or even on a piece of paper. It worked for original author of Zettelkasten and it works even better with computers we have nowadays. It does not depend on any databases, URI schemas or paths.

All you need is a unique ID anywhere in your note. You use it in a plain textual form anywhere you want to “link” to that particular note. Then you use search to find it. It’s only marginally more cumbersome than a link but it’s infinitely more reliable and future-proof. It can be automated to some extent too.

Personally, I use a YYYYMMDDHHmmss ID in my YAML frontmatter. When I see such an ID in another app, a click to select it and 1-2 shortcuts take me to an open Obsidian app that has already found a note I wanted to see. Works on my tablet and phone as well, although with slightly different mechanics of course. And if I give up Obsidian, none of those connections will be lost and searching will remain just as easy.

3 Likes

I agree with you, I use an approach absolutely similar to your one

I put it the UUUID of the exactly the same format in the main body the main body, Then , if I refactor I put a new UUID just above the spot the text I am moving and then again at the top of the piece moved itself. The Moved text will get its own UUID when formed but have an imbedded reference to the original text (and even located to where it was in original. Not enough experience to know if this extra step is really useful but it should provide a useful 'return to source" if I ever want to cite the document for external use or to go back to it again myself).

1 Like

Your approach shows how flexible really simple solutions can be. Sounds like you are using those strings of digits as markers / bookmarks rather than IDs, which should still keep such “links” relatively reliable when referring notes from outside. You are just sacrificing a bit of speed but gaining extra context when searching.

Personally, I prefer to rely on standard wiki-links to keep traces of refactoring within my Obsidian vault. Refactoring is always a dangerous moment regardless of the linking mechanism in use as it’s meaning that’s getting shifted around. I find that most references I make from outside are either ephemeral (tasks in task manager for example that will be closed in a matter of days, so I may even use obsidian://links for those) or they are links to notes with relatively “fixed” meaning: project hubs, lists, literature/reference notes for particular sources, howto’s for particular problems etc. I may move things around and add content in those notes but their general meaning remains the same. When I feel I’m stepping into a dangerous territory, I may do a system-wide search to see what I was linking to and why, pick refactoring strategy accordingly or adjust those links.

As for IDs, I prefer to keep them a 1-time instance in my system so they are actually unique and there is no ambiguity when searching. It ensures a direct 1 to 1 link when referring from outside. I also keep them in a fixed place in a fixed format for the ease of programmatic access in case I need it.

I don’t see why bookmark and ID approaches can’t be used simultaneously though. It would only take adding something extra to the main permanent ID to make a search for it unique. uid:20200529153042 or L_20200529153042would only return one result but 20200529153042 markers would then return both the original note and all the references to it within the vault.

2 Likes

any resolution to this yet?

Yes. Use Obsidian Advanced URI. It supports ID’ing and external linking of files by UID.

3 Likes

Could somebody please advise me how to actually use UUIDs with the the above mentioned plugin? I can get it to work without the UUIDs (eg obsidian://advanced-uri?filepath=Home%20Index%2Ftoday creates and opens a new note).

Do I need to generate the UUIDs myself or can this plugin do it for me? How do I specify the UUID so the plugin knows where to look for it - is there a format or does it need to be as a part of the filename etc?