Daily note template with tomorrow and yesterday links and annual folders

I spent a couple hours working on this this morning so I thought I would share in case anyone else is trying to get a daily note template set up with annual subfolders.
This uses the core Daily Notes plugin as well as using/working with community plugins Templater and Calendar (that is, clicking a date in calendar creates a new daily note in the correct annual subfolder, even if not already created, with correct yesterday and tomorrow notes). Also populates the day of the week and the full spelled out date in the header.

← [[Daily/<% tp.date.now("YYYY/MM-DD", -1,  (tp.file.folder() + "/" + tp.file.title), "YYYY/MM-DD") %> | <% tp.date.now("MM-DD", -1,  tp.file.title, "MM-DD") %>]] | <% tp.file.title %> | [[Daily/<% tp.date.now("YYYY/MM-DD", 1, (tp.file.folder() + "/" + tp.file.title), "YYYY/MM-DD") %> | <% tp.date.now("MM-DD", 1, tp.file.title, "MM-DD") %>]] →

# <% tp.date.now("dddd, MMMM D YYYY", 0,  (tp.file.folder() + "/" + tp.file.title), "YYYY/MM-DD") %> 

Creates a daily note header like this (edit mode):

or preview mode:

You could cut down on the breadcrumb code by using words like “yesterday” and “tomorrow” or “previous” and “next” but I prefer to have the dates linked so I made the code print those, too.

5 Likes

Nice. And for anyone looking, theres more discussion here

1 Like

Dumb question @coppereye:
I copied the code above at the beginning of my template (the one used by the Daily Note Plugin) but once the note is created the code is stil there as code: i.e., nothing is created
What am I doing wrong?
Thx!

I think it’s because you need to use the Templater plugin for this to work. :blush:

Yes I’m using Templater and apparently this other code (I found in another post) works:

### [[<% tp.date.now("YYYY-MM-DD", -1, tp.file.title, "YYYY-MM-DD") %>|⬅]] <% tp.file.title %> [[<% tp.date.now("YYYY-MM-DD", 1, tp.file.title, "YYYY-MM-DD") %>|➡]] # <% tp.date.now("dddd, MMMM Do, YYYY", 0, tp.file.title, "YYYY-MM-DD") %>

while with this one i get a date format error…
thanks anyway!

I think the default curly-brackets built-in templating date engine might have been updated to be smart enough to do this without Templatr? But I’m too new to be sure.

I’m still not getting a proper output when using either of the scripts. I will come back after more research.