A few different things are going on: link path, display alias, and this
. This is how I understand it; corrections welcomed…
What does “this” do, as in
attendees.contains(this)
Should I be using “this” instead of “this.file.name”?
Because this
is a file:
this
→ “path/to/note”
this.file
→ “path/to/note”
this.file.name
→ “note”.
Thus when your link in attendees
has a path, these are true:
attendees.contains(this)
attendees.contains(this.file)
… and this is false:
attendees.contains(this.file.name)
Why is Obsidian creating the Mary Smith link differently from how it’s creating links to other people?
Like rigmarole said, perhaps added during refactoring from the merge.
Another possibility is maybe Obsidian always includes a display alias when it, not the user, adds the link path (haven’t tested, just a suspicion).
For example, Obsidian adds a path when your new link format is set to “Absolute path” or “Relative path” (in Settings). It also adds a path—thus maybe the alias too—when linking to one of multiple notes with the same name. You had multiple Mary Smith notes earlier. It’s possible that linking to one Mary Smith without explicitly telling Obsidian which Mary Smith… is what started your whole saga. Prospectively.
And finally, when you merged notes and Obsidian updated the link for you, it retained the presence of a display alias. (This part I’m sure Obsidian does, because some people don’t like the way it chooses the new alias and have posted many-a-thing about it.)
How can I prevent this behavior from happening?
Double check for notes of the same name when linking??
That’s my best guess.
How can I quickly correct all the past instances of all people like Mary Smith where the links were created incorrectly?
Even though they’re not technically “incorrect” and they are usable with the right filters, I know what you mean. And having uniform property values is generally a good idea anyway. So…
To filter for notes where attendees contain a display alias:
attendees.toString().contains("|")
But as Rigmarole mentioned, I’m not sure that that alone caused the problem.
Another possibility is that since we have two filters that give different results, you could pit the filters against each other:
attendees.contains(this) != attendees.contains(this.file.name)
That could turn up notes like Mary Smith. Also might turn up any other irregularities
.