Problem with link labels (internal links)

Hi,
I’m trying to improve the readability of my note and I thought to use the markdown link system (instead of wikilinks) without enter the link right in the middle of the text but defining a label at the and of my note, like this:

Here I want to enter a [link][] to a file.

[link]: /path/of/the/file.md

I think this is the right markdown syntax, but when I click on the link Obsidian opens my browser using it as an external link.

I also used Vs Code to edit and view the note and the link works just fine.

Thanks in advance to anyone who can provide support.

The < > s take care of spaces in folders or files (if you have any) and the leading / isn’t necessary for Obsidian but is for ctrl+clicking in VSCode. Try this inline:

[link](</path/to/note>)

and the same at the bottom if you don’t need to see the link:

[link](</path/to/note>)

or this if you want to see the link:

[link: /path/to/note](</path/to/note>)

Thanks for your response.

The inline link works but I’m tryind to avoid it. I saw that markdown allows reference-style links and I was trying to implementing them in Obsidian.

If you need more context I can share what I read.

https://daringfireball.net/projects/markdown/syntax#link

1 Like

I figured you were going for a markdown reference link, but I’m not sure how to use those in Live Preview with internal links (or if they work at all). Hopefully someone else can chime in!

1 Like

I don’t think reference link style, aka [display][id] with [id]: https://my.site/page/link somewhere else, is really usable for internal links, but more of a tool for external links.

My lengthy test set for internal links

Try the following in a test note:

Reference style links I think are intended to avoid long external URLs within a text paragraph: _Look at [help][1] section externally, or check the [forum][2] for more information regarding Obsidian._

Attempts at internal links, in all cases the "display" text is the actual text used for reference link, which is just listed another place in the document:
- [Sandbox][s1a] - fail
- [(Sandbox.md)][s1b] - fail, even though `[Sandbox](Sandbox)` = [Sandbox](Sandbox) works
- [Sandbox.md][s2a] - fail
- [(Sandbox.md)][s2b] - fail, even though `[Sandbox](Sandbox.md)` = [Sandbox](Sandbox.md) works
- [/Sandbox][s3a] - fail
- [/Sandbox.md][s3b] - fail
- [app://local/Sandbox][s4a] - fail
- [app://local/Sandbox.md][s4b] - fail
- [app://local/Volumes/Local/tmp/Sandkasse/Sandbox.md][s4c] - fail
- [file://Volumes/Local/tmp/Sandkasse/Sandbox.md][s5] - fail? Opens as external file (in another editor in my case)
- [obsidian-open?vault=Sandkasse&file=Sandbox][s6] - OK, uses obsidian URL

My local full path for the Sandbox file: `$= dv.span(app.vault.adapter.basePath + "/" + dv.page("Sandbox").file.path)`


 [1]: https://help.obsidian.md
 [2]: https://forum.obsidian.md "What is this"

 [s1a]: Sandbox
 [s1b]: (Sandbox)
 [s2a]: Sandbox.md
 [s2b]:(Sandbox.md)
 
 [s3a]: /Sandbox
 [s3b]: /Sandbox.md
 [s4a]: app://local/Sandbox
 [s4b]: app://local/Sandbox.md
 [s4c]: app://local//Volumes/Local/tmp/Sandkasse/Sandbox.md
 [s4d]: app://local//Volumes/Local/tmp/Sandkasse/Sandbox.md
 [s5]: file:///Volumes/Local/tmp/Sandkasse/Sandbox.md
 [s6]: obsidian://open?vault=Sandkasse&file=Sandbox

This produces this output for me:

Note how the two first examples links to the help site and this forum site, works nicely, and will open up the links in my web browser.

The only two links actually working to link to my Sandbox file, are the obsidian link variant, which opens it within Obsidian, and the file variant which opens it in an external editor. I was kind of surprised that the app://local variants didn’t work, because I’ve used those for image references within Obsidian before (but then again that was a the source in an <img> element).

Not that it matters, but also note how all of these are marked with the “external” icon, indicating this is for linking outside of your vault.

1 Like

Wow. Kudos, @holroy! I think you covered about everything.

I had never seen an internal markdown reference-style link, and now with Live Preview, less reference-style links in general (but people probably still use them).

1 Like

Thanks a lot. I’m new to Obsidian and your post made me understand better the software.
Much appreciated.

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