Format the text in file.link or create a custom link to the file?

Things I have tried

  • 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.

  1. First you can create an aliases field in YAML frontmatter. E.g., for file my-file-name:
aliases: my file name
  1. 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 ""

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.