Block Reference ID Generation Question

In the announcement post: https://forum.obsidian.md/t/obsidian-release-v0-9-5/7260?u=varian93 it says:

  • Block IDs will be generated using the syntax ^blockid when using the auto-complete.
  • Alternatively, you can manually create the block ID using any alpha-numeric character.

That isn’t especially clear to me. It somewhat sounds like Obsidian will autogenerate a unique block id when adding a block id to a source file by adding ^blockid after the “block”, but not really, and it doesn’t.

So the next statement where it says you can manually create the block id… seems confusing as it says “alternatively”, as it doesn’t seem to be an alternate method, it seems to be the only method.

What am I missing? Are they all set arbitrarily?

I also noticed that you can create several identical block IDs in the same document. When these identical block IDs are referenced from another document, I can’t quite determine how Obsidian determines which of the identically named block IDs it transcludes/takes you to.

Any insight would be greatly appreciated.

Thanks

There are actually two ways like the documentation says.

  1. Method 1: Obsidian auto-generates block ids when you refer to a block. The way to refer to a block is to first link to a file like so [[testFile then press the carrot symbol, [[testFile^. Now Obsidian will show a list of all the blocks in the file testFile. When you select one of these blocks Obsidian will automatically create a block ID for that block.
  2. Method 2: You can navigate to the file which contains the block you want to reference (in our case it is testFile) and then at the end of the block you can add your custom block ID ^your-alpha-numeric-ID-here
5 Likes

Thank you, that clears things up.

I was testing block referencing on an empty test vault & manually entering ^blockid wherever I wanted to link to a block; I thought they had to be “initialized” first. I didn’t realize that Obsidian was “smart” enough to automatically recognize all blocks. It being an empty test vault I didn’t have any notes with enough content to notice it was identifying all blocks.

I’m now able to get it to autogenerate block IDs as well as arbitrarily assign them.

However I’ve noticed that you can arbitrarily set identically named blocks, to different blocks, in the same document, and when using the autocomplete to choose which block to link to it will always point to the one that you first choose. I believe that likely will require a feature request to have Obsidian warn that the blockid you’re attempting to use is already in use & will likely result in unexpected behavior… I’ll get to that later.

Thanks for your help.

1 Like

Is the block ID that auto generate by obsidian unique in a vault?
will it duplicate in another file ?
I want to use block ID as the uid of “obsidian advance uri”.

example:

---
uid: 7e8fb44f-86e7-6a32
---

[click me to jump](obsidian://advanced-uri?vault=testVault&uid=7e8fb44f-86e7-6a32)
1 Like

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