using .replaceAll on file.link, but it is not a string
What I’m trying to do
Because the repo I am using is in Azure it needs to have hyphens instead of spaces in file names. When I use file.link in a dataviewjs I would like to format the text shown so that ‘my-file-name-link’ becomes ‘my file name link’.
I don’t mind if this is via formatting file.link or creating something using file.name and file.folder. I haven’t used JavaScript for a while so some help would be appreciated.
Thank you.
I know nothing about javascript. But using simple dataview query it’s possible to do that creating aliases.
First you can create an aliases field in YAML frontmatter. E.g., for file my-file-name:
aliases: my file name
Using new plugin features you can create a table query removing the file name and create a table column with an expression able to transform the aliases in file links. Something like this:
```dataview
TABLE WITHOUT ID ("[[" + file.name + "|" + file.aliases + "]]") as YourColumnTitle, file.tags
FROM ""