Before filter:
![]()
After filter:
![]()
Many of my notes have multiple aliases to allow for grammatically correct auto-linking while writing, without having to type a display name manually every time. However, this becomes an issue when displaying aliases in Bases — for example, below note titles(Display aliases below the note title). For this reason, I use a Bases formula to filter out aliases that are essentially just duplicates of the file name.
In my case, I only want true synonyms of the file name to be displayed, so I filter out singular and plural variants (note that this only works for plurals formed by adding “s”). These filters are by no means exhaustive, but they are sufficient for my use case. This may be a starting point if you need more strict filtering.
aliases
.filter(if(aliases.length < 2, true, !aliases.map(value.lower()).contains((value.lower() + "s")))) // Remove duplicates in aliases, keep plural
.filter(!(file.name.lower() + "s").contains(value.lower())) // Remove singular or plural of file.name
.filter(!(file.name.lower().replace(" ", "-") + "s").contains(value.lower().replace(" ", "-"))) // Remove variants of file.name with hyphen instead of space