Add Excerpt to Alias on Block Link Creation

Use case or problem

When generating links to text blocks, the default format ([[Note title #^blockID]]) is unsightly and uninformative. It makes it harder to understand the context of the link without opening it. It would be helpful to have a cleaner and more meaningful link format.

Proposed solution

Add option to automatically add the first x characters of a text block as an alias when generating links to text blocks.

For example, when generating a link to this block via the auto-suggester:

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent eu aliquam ligula, quis rhoncus nulla. Ut ullamcorper porttitor rhoncus. ^abc123

Instead of creating [[Note title > ^abc123]], create:

[[Note title > ^abc123|Note title > Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent eu aliquam ligula, quis rhoncus nu...]]

  • The alias would include the first x characters (100 by default, configurable) and truncate with an ellipsis (...) if it exceeds the limit.
  • There should be an option to include or exclude the Note title > prefix in the alias.
  • Obsidian should determine if the block contains text, since not all blocks are text blocks. If not, it should fall back to the default link format without an alias.

Current workaround (optional)

  1. Manually editing each link to add an alias. This is time-consuming and error-prone.
  2. Something like this should be possible with a Carry-Forward command, although I ran into an issue.
  3. Perhaps a QuickAdd macro or a Templater script could be created for this purpose.

Related feature requests (optional)

  1. When pasting a link, set the link text the title of the web page
  2. How to automatically set the alias to the title text when creating a block link
  3. Include note name (or breadcrumbs) in heading link embed
  4. Copy Block Link: Option to use first x characters as alias on link copy
  5. Block Link Plus: Option to use first x characters and/or selection as alias on link copy
2 Likes

It has to be mentioned that you can use Page preview to preview links although it would be useful to generate more informative display names for block links.

1 Like

This was recently added to Block Link Plus.

As an alternative, I also created a Templater script that copies link to block and uses selection as alias: