Template File Name Format

Use case or problem

I currently deploy my second brain to my own website. Because of this, I need my new notes to have a specific file format (all lowercase).

I’d love to create a note by linking, but always have a certain file format. For example, if I could create a note by going [[Isaac Newton]] but have the file created as isaac-newton.md it would save me a bit of wrangling.

Proposed solution

It’d be nice to have some sort of feature that allows me to define how I want my files created. Maybe it’s just a regular expression?

Current workaround (optional)

  1. Create new note by linking like this: [[isaac newton]]
  2. Once file is created, change the link to this [[Isaac Newton]]
2 Likes

Yes, I second this. Specifically I don’t want files created with spaces, as these really mess around with cross-platform vaults.

Underlying this is the need to separate a notes presentation name with its filename. Of course, internally that probably is the case, so little adjustment should be needed.

1 Like

@amorriscode and @eastmad -

Wouldn’t creating the file from a link like [[isaac-newton|Isaac Newton]] do just that?

It would show up like [[Isaac Newton]] in the link, but the file would be called isaac-newton.md - once you click that link in preview mode or Cmd-click in edit mode, it gets created. Just tested that.

The other way around - if you create and name your new notes from scratch, you’d just call it isaac-newton and when you need a link to it somewhere in another note, you could create the link like [[isaac-newton|Isaac Newton]].

The only thing it won’t do, is show up in the File Explorer als Isaac Newton. It will be called isaac-newton. Maybe you could achieve that by using regex and CSS or something, but why would you?

You could also use the YAML to set an alias for that note, you can link to it by whatever alias you set for it.

I think you have perfectly demonstrated the difference between a how a template ‘default’ action should behave and a one off change. It is wasteful and error prone to continuously double write a file link / display name when you can easily create a template to describe your intention. This is what computers are good at - cutting out extraneous work. Note that you have also changed the case for the Isaac Newton filename (isaac-newton). Think about that for a moment.

Well, I only typed it as isaac-newton because on my phone, it shows a dash in @amorriscode 's message. I understand he wants lowercase filenames and he wants to link to them with the words with starting capitals. I am only demonstrating that we already can, and with very little effort at that.

Perhaps I don’t understand very well what you mean by double typing links and that being wasteful etc. Or do you mean the first option I gave, and YAML is the way to go?

With YAML you only have to state once that your isaac newton note can also be linked to as Isaac Newton.

Even if you create 100 notes a day - use a note template that has

---

alias:

---

and it will cost you 2 secs to fill in the alias for any given note. That’s 200 seconds per day. What is wasteful in a little over 3 minutes per day?

The alias could even be something totally else, as long as you can remember that you mean isaac newton.md

So personally, I still don’t see the need for extra hocus pocus to magically save notes names in lowercase without spaces. I just name them however I want and use an alias for linking to them.

1 Like

Alias looks great, thanks for mentioning it, but that is about links - not filenames.

So the issue is specifically with the filename a note gets on your system, not the name of he link internally. I use the same obsidian vault on mac and PC, so the filenames are quite important.

I can see also see that I should have been a bit more careful about describing how repetition creates errors. This is a programmer issue more than a general user issue. As a developer, I know that things that make you repeat yourself unnecessarily cause errors. And if I want to put the obsidian files through some type of pipeline, then I don’t want to deal with lots of small issues because of a misplaced capital letter. I hope that makes sense.

1 Like

But what are you after then, exactly?

Would you want Obsidian to automagically remove capitals and spaces from your filenames? In case you forget to do so yourself? I’m sure both Windows and Apple have scripting capabilities to do that, I just wouldn’t know how.

Personally, I do not use my notes to be processed by , only Dataview which can do enough in my case. And it even handles spaces and capitals :slight_smile:

I have a feeling what I’m looking at will come in because another tool needs to control filename, title name and link name separately.

1 Like