With 2 headings of same name in file can only link to first one

Here is some explaining on the block link approach as suggested by @ariehen , as you could add a block link to either heading, preferably the one you can’t link to, allowing it to be linked by that link instead of the heading link. Note however that this do require a little more typing, and you can’t use it for embedding as it is a pure link to that block (aka the heading).

An example:

### A heading

First appearnce as H3

## A heading ^h2

Second appearance as H2

# A heading ^h1
Third appearance as H1

## Somewhere else

[[#^h1|A heading]]

The link at the bottom will send you to the current file’s block id of ^h1, which preferably could be something more readable I guess… :slightly_smiling_face:


On a slightly related note… You’re allowed to stack the heading links using # to get to a header lower down, but you can’t use the same technique to select a more specific header in the autocomplete. Check out this example:

## a

### b

text b

## a

### c

text c

## test area

Autocomplete available for this one: ![[#a#b]]

No autocomplete for this one: ![[#a#c]]

These embeds (and thusly links) will properly connect to their correct nested heading.


Using this knowledge and a header structure such as:

  • heading a
    -heading b
    • heading c
  • heading c
    • heading a

You could then use a higher heading to specify the one you actually want, like in [[#heading c#heading a]] to get to the last appearance of “heading a”. You can’t use auto complete to find that though… And it does require for a somewhat proper heading structure in your document.

3 Likes