People @-mentions

Published with Share Note 🔸 Part of Obsidian guides

I have a quick Templater script which solves this for me.

I have a People folder with a note for each person I reference. In the gif above you can see that I have prefixed my people with the ’@’ symbol, but you do not need to do that.

No symbol is needed, it just works off the names of the notes. If you don’t like the ’@’ symbol, you could use the 👤 symbol, like this: 👤John. It works perfectly fine as a note title or in a filename on Windows or Mac.

When I want to mention someone I use the hotkey Alt+2 (the @ key) which inserts this Templater template:

(remove the space in < %* at the start)

< %* 
// Get the list of people
const folder = 'People'
const people = this.app.vault.getFiles()
  .filter(f => f.path.startsWith(folder))
  .map(f => f.basename)
 
// Pop the suggester
const person = await tp.system.suggester(people, people)
 
return person ? `[[${person}]] ` : ''
%>

When you press Alt+2, a suggester list pops up on the screen, you just start typing the name of the person and press Enter, and the script will automatically insert the link to that page. Super super fast.

If you don’t like filling in a specific note for a person, then I recommend to use a Dataview that automatically shows all the linked pages for that person. That way the person page will be useful in that it lets you immediately browse out to all other mentions of that person.

If you want to make the list of people a bit more useful, you can also sorted it by number of notes mentioning that person:

< %* 
// Get the list of people
const people = app.plugins.plugins.dataview.api.pages('"People"')
  .sort(x => x.file.inlinks.length, 'desc')
  .file.name
 
// Pop the suggester
const person = await tp.system.suggester(people, people)
 
return person ? `[[${person}]] ` : ''
%>