Obsidian URL from dataview links

What I’m trying to do

Sometimes I use dataview to gather sources about a subject, or lit notes written by a certain author, etc.
I still don’t do all my real writing in Obsidian, so what I do instead is that from the external app, I often link to various notes stored in my vault. But right now, I can only do this linking one by one. E.g., if I have a dataview list displaying 10 items, I have to navigate to each of them, right click in the sidebar, copy Obsidian URL, paste.
Does anyone do something similar and have a way to expedite this process? Unfortunately, you cannot just copy/paste the links displayed in the dataview list.
(This seems to me like a scriptable process, except that I can’t do it…)

Certainly this is not the most ‘clean’ way and the most elegant code (I’m not a coder or similar, just a simple Obsidian user), but you can try this:

```dataview
TABLE ("obsidian://open?vault=YOUR-VAULT-NAME&file=" + replace(file.path, " ", "%20")) as "Obsidian URL"
FROM ""
```
  • replace YOUR-VAULT-NAME with the name of your vault (attention to the spaces - if any, replace space with %20)
  • the function replace() is used to replace all the spaces in the file.path with %20
  • the column “Obsidian URL” gives you the full Obsidian URL (as text, not as a link)

If you want the URL as a link (to easy “copy” with right click), change to this:

```dataview
TABLE elink(("obsidian://open?vault=YOUR-VAULT-NAME&file=" + replace(file.path, " ", "%20"))) as "Obsidian URL"
FROM ""
```

Let me know if it works.

5 Likes

This is awesome (and I never would have figured it out…), many thanks!!! Works great.

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.