Create a missing daily note later, but correctly templated

In some of my notes I wrote informal log entries which link to daily notes in my usual format YYYY-MM-DD . Unfortunately I forgot to create the daily notes itself ;-(.

This happened more than once. I would like to create the missing daily notes after the fact but want the complete frontmatter analog to the daily notes which I create punctually.

For ‘normal’ daily notes I have a templater script which uses the current date for the note title, moves it to the right place and sets some frontmatter properties like date and archived .

When I click on the links to the missing daily notes an empty note with the correct name is created in the standard place for new notes.

I look for a templater script which takes this newly created file, moves it to Journal/ and sets the date property in frontmatter to the value of the title.

Unfortunately my templater knowledge sesems to be insufficient.

I looked in the templater documentation, the forum and the plugins to no avail.

If you setup file regex templates in Templater settings, you could have a regex for /^\d{4}-\d{2}-\d{2}\.md/ (or something like that) and have the template be your daily note template. Then when you click on a link to a non-existing note, the file regex template should pick it up and apply your daily note template.

In case someone is looking for this with ‘daily note’ in mind, like me. As in: core plugin daily notes with core plugin templates and community plugin calendar:

You can still use the solution above with the community plugin templater, but it is a completely isolated setup from your existing daily notes setup (in a good way, I guess, as it does not “interfere” with creating daily notes from the calendar or core plugin as usual).

That means for clicking missing date links:
You cannot use your existing daily note template and need to add a command to move the note to your daily note structure.

Regex: ^your-default-note-folder\/\d{4}-\d{2}-\d{2}\.md$
Slightly adjusted to make sure this triggers for date notes created in the default note folder (and only there), i.e. from clicking a missing date link.

New template for daily note from templater (example):

---
uuid: "<% tp.date.now("YYYYMMDDHHmmss", 0, tp.file.title, "YYYY-MM-DD") %>"
title: "<% moment(tp.file.title, "YYYY-MM-DD").format("YYYY-MM-DD (ddd)") %>"
more: "use the same properties"
properties: "as in your 'default' daily note template"
---
<%* await tp.file.move("/your-daily-notes-folder/" + moment(tp.file.title, "YYYY-MM-DD").format("YYYY") + "/" + moment(tp.file.title, "YYYY-MM-DD").format("MM") + "/" + tp.file.title) %>

After setting some properties, this moves the new note from /your-default-note-folder/YYYY-MM-DD (see regex) to your-daily-notes-folder/YYYY/MM/YYYY-MM-DD. Adjust to your needs.

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