Block links in DataviewJS

tl;dr: Until someone/something defines the blockId by adding the ^yourBlockId to the end of your block, the blockId is not defined.

I did some more research and found the following:

  1. Block reference ID generation question, #2 (which also references the 0.9.5 release notes) – This indicates the two methods of generating blockId’s: By searching/auto-complete, or by definitions

  2. Forum post Right click menu item to generate block … reference lead me to Copy Link to Block – Further indication that the blockId’s don’t exist by default

  3. Copy Block Link plugin – A plugin to actually generate the blockId’s, which turns out to actually add the definition to your actual file, not only add it to the metadata

  4. Available metadata in dataviewjs (see the end) – blockId only present if defined

So to conclude my research:

  • BlockId’s are not defined all the time, and either needs to be generated when doing a search or autocomplete like in the [[SomeNote^...]] case, or be defined by adding ^YourId at the end of a block
  • If the blockId is defined, then dataviewjs would present it, and if applicable the .link would include it (differentiating it from the .section link.

When testing this out in a Sandbox vault, I’ve also concluded that until you somehow define the blockId, it’s not present. And I also found that when you do the auto-completion block link, it actually insert the blockId definition for you.

1 Like