Link autocomplete should favor pages over attachments (papercut fix)

Use case or problem

Dense, speedy page linking is the feature of Obsidian, and this is managed through link autocomplete. However, the sort order of autocomplete seems to be alphabetical by file folder, which can result in circumstances where attachments appear before pages:

This is an example of not meeting reasonable user expectations. In this case, the attachment Twitter-ContextMode.jpg appears first, despite the query context mod matching the page Context Mode even more accurately than the attachment in three ways:

  1. The addition of a space that link autocomplete ignores
  2. The use case context of creating a link, which should favor the most common usage of the product and what users expect (links to pages)
  3. The narrowness of the query, of which Context Mode is a narrower and thus closer match than a larger file name that may include context and mode as two words among many.

In other words, page linking, not attachment linking, should be the lowest friction action when using link autocomplete.

Proposed solution

At the very least when matching contents in link autocomplete, for identical queries pages should appear first. A simple sort rule may be:

  1. How close query matches every item in vault (closeness)
  2. Then based on identical closeness, a) alphabetically by folder for all pages, then b) alphabetically for files in attachments folder

Some additional ideas:

  • when embedding (using ![[thing.jpg]] notation), do the opposite and prefer attachments > pages, since that is the likeliest user intent.
  • consider similar rules for pages > page aliases
  • take into consideration the narrowness of the query, as mentioned above.
  • the order in which the words appear may also be good to bring in (e.g. context mode is favored over another file like mode for determining context)

There’s probably other ideas that can go into building link autocomplete to maximize the likelihood of meeting user expectations, and I think they’re worthwhile to explore given the feature is a central and load bearing part of Obsidian, even if these circumstances do not come up too often. I love the headline features we get but it’s these types of papercuts that can really add up to frustration with products.

Current workaround (optional)

Related feature requests (optional)

Link autocomplete order : aliases should show up below real notes names is the same class of problem: link autocomplete sort order not meeting the expectations of users. I believe it was dismissed prematurely and have experienced this as well.

1 Like