Zettelkasten prefixer (core plugin): creates files with incorrect date (incorrect "see if the file name already exists" check)

“Zettelkasten prefixer” (core plugin): creates files with an incorrect date (incorrect “see if the file name already exists” check).

Intro

  • I don’t like the standard Zettelkasten “YYYYMMDDHHmm” file format. It’s too bulky, it contains too much unnecessary information and it lacks the relevant information I need (when there are hundreds of files I would like to at least know what the general topic of the file is).

  • Previously, in my file system I used “YYYY-MM-DD_[general-topic-of-the-file]” format (like: “2021-07-03_creative-process.md”). Unfortunately, it doesn’t work for various reasons (like the graph being all unusable).

  • Just using date and spaces (“2021-07-03 12 rules for life”) is too confusing - there needs to be some kind of separator. I chose a simple dot (“2021-07-03. 12 rules for life”) and can live with that.

  • Therefore my zettel ID format is “YYYY-MM-DD.”. I create a file, add some additional name/title words and everything works.

  • If I wouldn’t add the additional words in the title and would attempt to create a new zettel file using the prefixer, it would create a file with an increased index (i.e. for the next day). This is not a problem and this is how it should work.

Problem

But the problem is that this “see if the file name already exists” check has a bug. It creates a file using the next day’s date even though no file with the current date and no added words exist.

Steps to reproduce

Basic setup

  1. Enable Core plugins → Zettelkasten prefixer.
  2. Go to Zettelkasten prefixer settings and change “Zettel ID format” to “YYYY-MM-DD.”.
  3. In hotkeys assign “Create new Zettelkasten note” to “Alt + Z”.

Test 1 - confirm the correct functionality

  1. Create a new note by pressing Alt + Z. A note named “2021-07-03.” will be created.
  2. Press Alt+Z. Another note named “2021-07-04.” will be created. So everything is exactly like it should be.
  3. Delete both files.

Test 2 - confirm the correct functionality

  1. Create a new note by pressing Alt + Z. A note named “2021-07-03.” will be created.
  2. Delete the dot and add space and “test”, so the result will be “2021-07-03 test”.
  3. Press Alt+Z. Another note named “2021-07-03.” will be created. Since no note with the exact same prefix exists, the new file will still have the current date. So everything is like it should be.
  4. Delete both files.

Test 3 - confirm the bug

  1. Create a new note by pressing Alt + Z. A note named “2021-07-03.” will be created.
  2. Add space and “test”, so the result will be “2021-07-03. test”.
  3. Press Alt+Z. BUG: a new file with the name “2021-07-04.” (next day!) was created even though the file with the name “2021-07-03.” doesn’t exist.

Expected result

The “if the file with the same name already exists” check should compare prefix with the whole file name, not only with the beginning of the file name. “2021-07-03. Review of the movie The Dark Knight” and “2021-07-03. My gratitude letter to my parents” are totally different notes. It’s the whole name that matters, not only the beginning.

Environment

  • Operating system: Linux Mint 20.1 Cinnamon
  • Obsidian version: 0.12.5

Additional information

I don’t consider this a bug. The check is not simply “if a file with the same name already exists” but “if a file with the same ZK prefix exists”.

I think you can achieve what you want with the daily notes plugin or third party plugin.

You are better served with the Daily Notes plugin.

Thank you for such a quick reply and practical suggestions!

Unfortunately, I am already using Daily Notes plugin for daily notes (with the format “YYYY-MM-DD_[daily-note]”). My zettel notes are distinct from those.

I understand your “it’s about prefix therefore not a bug” argumentation, but I would like to argue that it is still a bug. Or at least something that needs to be changed.

  1. The traditional zettel only has date+time in its name. The main idea is not so much as to provide directly useful information in the file name (nobody really needs to know what exact second was the note created; the main idea of zettel is that all the information is in the notes and in the connections between the notes; the file names are irrelevant), but to make them unique.

  2. Date+time seems like an easy choice, even though it could have been UUID or similar. So it’s the uniqueness of the file name that matters.

  3. There is a reason why “Zettelkasten prefixed” plugin allows for Zettel ID format to be edited. It’s because the developers understood that the traditional setup might not be optimal for everyone and they wanted to allow for different implementations. A few examples of people arriving at different results while achieving the same goal of uniqueness: Zettel ID format — Zettelkasten Forum

  4. Thus I argue that my note name format is within the rules that were understood, designed, and established by the developers. It’s just that my zettel note names are not fully automatic, but in addition to the automatic date also require some manual work (writing some keywords of description), which I am happy to do.

  5. Therefore it feels like “only check the prefix and ignore all the rest” goes counter to both the original design as well as common logic/behavior.

  6. People using the full zettel format didn’t encounter this problem, but this doesn’t mean that the problem in implementation was not there from the beginning. Out of two choices (compare with full name vs. compare only with the prefix) developers chose the wrong one (imho) - the latter. And it worked fine until now. This is very typical in software development - one encounters way fewer problems if using only the default settings. Well, it so happened that the default settings were not suitable for me. I changed them and encountered the problem. I think that the problem should be fixed. It would help the non-default users, would not hurt the default users, and would be true to the original design and intent.

Thank you for reading and considering my argument.

I disagree here, the whole point of ZK plugin is to generate a unique prefix.

If you end goal with this procedure is to produce

2021-07-03. Note1
2021-07-03. Note2

Then 2021-07-03. is not unique id since there are 2 notes with same prefix.

If you only care about uniqueness of the filename and you are adding titles, why bother with any ugly numerical prefix? Just write the title of the note.

If just wanna add a date at the begining of your filename as a reference but not as ID, then use templater community plugin (since you are already using daily notes).

Because I find it very useful to:

  1. quickly see when the file/note was written
  2. see notes in order

The date+name format in my files is the reason why I never encounter a typical problem of file names like: “Final proposal.doc”, “Final proposal - reviewed.doc”, “Final proposal - reviewed (2).doc”, “Final proposal - final.doc”, “Final proposal - final2.doc”, “Final proposal - final-final.doc”…

My normal notes and my zettel notes have a different format, both the title and especially the content.

What I want is to have 2 simple hotkeys. One creates a daily note (in separate directory) and another creates a zettel note in another directory. I have been using “Daily notes” and “Zettelkasten prefixer” plugins for that. It works with the exception of the problem described above.

What you want is legitimate. However, as I a expressed multiple times the ZK plugins is designed to generate notes that begin with a unique prefix and you are trying to use it to generate notes that do not have a unique prefix. You are using the wrong tool for job.

If we make the change to satisfy your workflow, we will brake the workflow of people who are using the ZK plugin for its intended purpose.

There are many plugins for generating notes titles accouring to whatever pattern you want. Just use of those.

1 Like

I feel like Zettelkasten prefixer too smart for its own good. It auto-increases the number as OP said.

Same case with YYYYMMDDHHmm format. It will increase the final mm minute if you try to create an existing file. For example if you try to create multiple Zettelkasten notes at the same time/minute.

I rather they just make it so the next note is ID’d YYYYMMDDHHmm(1) and so on. Although I understand people may find it ugly.

The issue occurs if a user is so speedy that they create two notes within the same minimum unit of time used by the prefixer (usually a minute).

I have added seconds to the prefixer:

YYYY-MM-DD-T-HH-mm-ss

… so I only run into the issue if I type super quickly and create two notes in the same second.

Angel

1 Like

I personally create several notes with the titles first and edit the content later. That certainly happens under 1 min. Yeah adding second is the easiest solution. I was overcomplicating thing.