Link aliases with headers

Use case or problem

I often make notes with headers all relevant to one topic. The reason that I choose not to split these into multiple smaller notes is usually that each header only contains a couple sentences to a paragraph, so it’s simpler to keep them in one note. However, I may want to reference this header, for which I use the “link to header” option ( [[title#header]] ). At the top of the note, I will put aliases for the headers I frequently reference.

Proposed solution

What I would like is: when I type in the alias I want, if that alias is the same as a header within the note, Obsidian will automatically generate a link to the header ( [[title#header|alias]] ) instead of ( [[title|alias]] ), which I have to manually add the header to.

Current workaround (optional)

I am just doing it manually right now

2 Likes

Good idea.

Maybe even just a quicker way to get to the autocomplete pop up with the headings for the current note would help your issue. Maybe I will make a feature request for a hotkey to do that. If I do, I will link to it here.

In the meantime, you may find it helpful to create a macro (with Autohotkey or Keyboard Maestro, etc). If you haven’t used these before, they are actually pretty easy and fun. You could simply setup the macro to hit the following sequence of keys:

  • press F2 (select current note title)
  • press ctrl c (copy)
  • press [[
  • press ctrl v
  • press # (bringing up heading pop up)

Depending on vault size, computer, etc, you may want to add a little sleep time between keystrokes. I have created similar macros in the past, and occasionally they don’t work perfectly, but are surprisingly good.

That being said, I really like your idea.

Thanks.

1 Like

Thanks, I’ll try the macro! I use them for repetitive LaTeX commands but nothing so complicated as this, so I appreciate you providing an example of how to do it.

Another use case is glossaries, I tend to keep files with a bunch of domain related terms separate from the rest of my notes, so I can go through and link that definition later, so I can refresh my memory simply by hovering the mouse over a specific term when working through something with a lot of domain specific language.

I’m not sure if I’m understanding the OP, but there is the block link [[^, which works to link to anything within the same note just as it can link to blocks in another note. Within the same note, you type [[^ and are presented with a list of all the line items in that note. You pick one and it creates a numbered link, and you can add a pipe alias name so in Preview mode it looks nice, though in edit mode you see the number.

Since the OP is from March, its very possible this feature didn’t exist then.