I have ran into the same problem and solved it like the following:
- Install Templater plugin
- Set a Templater Folder template, so that any note in your Zettelkasten folder gets a template applied automatically
- Open the template file you have just specified - well, maybe you need to create the template before you can execute step 2, but displaying code blocks in numbered lists is awful.
Choose this template code:
<%*
if (tp.file.title == "Untitled") {
// Wenn die Datei gerade neu erzeugt wurde, hat sie noch keinen definierten Titel, er muss nachgefragt werden
var noteTitle = await tp.system.prompt("Titel:")
} else {
// Wenn die Datei aus einem Link erzeugt wurde, hat sie den Linknamen als Dateinamen
var noteTitle = tp.file.title
}
fileName = tp.date.now("YYYYMMDDHHmm")+" "+noteTitle
await tp.file.rename(fileName)
-%>
---
Created: <% tp.file.creation_date() %>
---
# <% noteTitle %>
---
Tags:
Created: <% tp.file.creation_date() %>
Ignore my comments in german, what really matters is the if-else-logic at the top and the usage of noteTitle.
When you create a new note, you do it basically in two ways:
- Press Ctrl+N (or “New Note”)
- Klick on a link which is currently not defined
In case 1: Obsidian creates a new note called “Untitled” in the folder, Templater recognizes the new file, and that it is currently called “Untitled”. It asks you for the desired title of the file.
In case 2: Obsidian creates a new note called like the link in the folder. Templater recognizes the new file.
In both cases, after the file has a well-defined name, templater gets the current date and time and prefixes the new file’s filename with a Zettelkasten ID generated from the date and time, and basically renames the note’s file on filesystem level.
Obsidian notices that the file is renamed and rewrites any links, most probably the inline link from which the file was created.
Only downside i haven’t managed yet is that the Zettelkasten ID is appearing in the originating link, is appearing in the graph view, and whatnot. But at least this is a very convenient way how to create a note with Zettelkasten ID inline.