Warn if daily note has already been created

Warn if daily note has already been created

When I use the command “Daily notes: Open today’s daily notes” it creates a duplicate if this daily note already exists in a folder.

image

When I now call the command, either through buttons or the command pallet, it adds the same date with the same name.

image

I use quite a lot of Templater and Quickadd and those project lists can get pretty big and it is easy to loose sight over which notes have already been created.

Does anyone have a real solution. I know crtl + O exists, but this does not work with templater.

Another solution would be if somone has a js script they use, that checks the vault for file names and returns a warning when a duplicate is detected.

Things I have tried

I tried to code something, but I have no idea when it comes to coding

This might also be a featur request, but i wasn’t sure.

If there is something that isn’t clear, just let me know.

Thanks :slight_smile:

Obsidian will not create a note with the same name as a note that already exists in a folder. Here’s how I configure the Daily Notes plugin.

First, the daily notes are always put into the same top-level folder. In my case the folder is Journal, which exists at the root.

Second, I configured “Date Format” in the Daily Notes plugin as

YYYY/MM/ww/YYYY-MM-DD ddd

This automatically creates, in note already existing, or uses, if already existing, a set of folders for year, month and week, and then creates a note with the name like 2023-08-23 Wed, if it doesn’t exist already when I press “Open today’s daily note”.

It appears from the OP’s screen shots that they are placing daily notes all over the vault, which can result in duplicates because the Daily Notes plugin only looks in the defined location for creating notes. If a location is not defined, then the currently selected folder is used. This can result in duplication.

2 Likes

Indeed. I want to put the daily notes in the project folder so I can have a clear view on which project i have worked on on which days. I use dataview to see the days associated with the project, but i would still like to have it in the projects folder if possible.

I guesse I could just create a dedicated folder and link to the projects from there, but I think this is just another band-aid.
I get how it works, but I really don’t get why Obsidian allows it. I can’t imagine a single use case for duplicate notes, especially if a mistake like this can happen so fast.

Thank you for you very much for your quick response. I’d still prefere a nicer solution :sweat_smile: but will look how putting them in the same folder works out.

cheers

Putting it into a Folder, which is dedicated to my daily notes does not work either, because I have automated it in such a way, that it automaticly applies a backlink when the new note is generated. It links to the projects folder note, in which I have an overview over all the documents linking to it via dataview.
When I assign the location to a dedicated Daily Note folder I would have to create each link by hand, which i try to avoid.

I hope this explains my conundrum a little bit better.

I see what you’re doing. I don’t think the core Daily Notes plugin is going to change to allow more than one note with the same day name – since its philosophy is one-day–one-note. The advantages of the Daily Notes plugin are a one-click icon to create the daily note, and a defined template for that note.

Otherwise, it’s just a note. So, maybe if instead of using the Daily Notes plugin, you get the same one-click / one-stop advantages with your own template, with a “one-click” hot key assigned in Templater, that isn’t constrained by the “no-duplicate” rule that Daily Notes is constrained by.

Think a little out of the box and you can do better than the built-in automation with the same amount of effort.

2 Likes

That’s not really a “duplicate”. It’s just the same title. There is nothing wrong with that. Except how you wish the command would open that existing note.

Notes are files on your computer. You can have the same-named files in different folders on your computer’s filesystem too. There would be no reason for Obsidian to disallow users from doing this. But it could be an interesting plugin idea, for managing your specific workflow.

Your “band-aid” sounds like a good way to do things to me. Keep the dated files in a standard location, and link to your projects. Otherwise, keep different naming conventions for daily notes and dated project notes. Perhaps your template can include the project name or some project ID code in the title. Or simply accept the matching names. You can filter things by path too.

What isn’t clear to me is what happens if you are taking dated notes on 2 or more projects in one single day? Even if daily notes prevented identical names, this would break, wouldn’t it?


Personally, I keep notes about my project in a project note. (And manage those notes in a Kanban board.) I don’t need the name of the file to be a date. I put date stamps inline in the project note. And that note grows over time. Tasks get pulled out with Dataview into a task dashboard.

If a major topic branches out of this note, it can become a new note, and get linked.

So as an alternative, I’d ask why you need separate files for different days. Consider just having a single journal note for each project. Just a personal suggestion! I completely get that it might not suit your workflow.

(As a side note, even in my journals, I’ve started keeping monthly notes instead of daily notes. Which makes it easier to read through, review, and find connected themes to expand upon. There are times when ideas should be atomic. Free-form journalling, and taking project notes seems better to be cohesive, for me.)

1 Like

I had no time to answer earlier, but what I wanted it to do was open the daily task file in the other folder and me backlinking to the second project manually.
The logic:

  1. Click button to open daily note
  2. a) if the note does not exist the create it in the current folder
    b) if the note already exists in another folder just open the note.
  3. i can then manually backlink to it.

Now having worked with my set-up I actually think having daily notes with the same name, indicating the day, might be a better solution for my workflow. It keeps things tidier. One problem I have encountered with this, is that when a due date also falls on the same date it fucks up the display, because it has to now display the path for the link to work :frowning:

image

The dataview table is fine, but it is distracting in the note.


I actually found some sort of workaround :smile:
I used Quickadd and templater.
I use a Button to call a templater template via Quickadd. I do this, because I can name the Note with Quickadd before it is even created.
In the file I have a templater function that calls the name of the parent folder and I have [[ around it, linking it back to the project allowing for dataview to call the “Project::” variable.
I then use <% await tp.file.move(“/Daily notes/” + tp.file.title) %> to move it in the Daily notes folder and retain the name.
I tried changing the name via templater too, but it didn’t work, because it got into conflicts with the file mover function.

It isn’t perfect, but if I now try to create a second file with the same name and push it into the same folder, it does not run the templater commands an you can directly see that something is wrong. It is also forced out of the daily notes folder and put into root. I get that, but I have no clue why it does not execute the templater functions.


I’ll have to see which option I will use now.
I hope that this workaround might help someone looking into the same issue

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