Skip to content

How to fix links in daily notes not using daily notes template

Posted on:May 4, 2023

If your daily notes template has links to yesterday’s and tomorrow’s daily notes, then it’s possible you’ve run into the issue where clicking on a date in the Calendar plugin will apply your template, but clicking on links to yesterday’s and tomorrow’s notes will not apply your template.

If this is the case, you can solve this with the folder templates feature of the Templater plugin.

Turn on folder templates

In Templater settings, setup the following settings.

Here’s what my folder template settings look like.

When clicking on a link to a note that doesn’t exist, Obsidian will create the note based on the “default location for new notes” setting. You can override this by including the path to the note in the link. For example, clicking on a link formatted as [[2023-05-04]] will create a new note in the default location, but [[Daily Notes/2023-05-04]] will create a new note in the “Daily Notes” folder.

Here is an example of a Templater snippet for a link to yesterday and tomorrow that includes the folder. You can find other examples on my Templater snippets page.

<%*
const linkFormat = '[Daily Notes]/YYYY-MM-DD';
const yesterday = tp.date.now(linkFormat, -1, tp.file.path(true), linkFormat);
const tomorrow = tp.date.now(linkFormat, 1, tp.file.path(true), linkFormat);
-%>
[[<% yesterday %>]] | [[<% tomorrow %>]]

Other potential settings to change

If the above doesn’t work, try adjusting the following settings.

Conclusion

And that’s it! You should now be able to click on links to yesterday’s and tomorrow’s daily notes and have your daily notes template applied.