About daily journaling templates and dycamically generated date links

Use date: ... in your files

If you put a property called date with a proper date, you’ll be able to use file.day from within dataview and various other plugins. Then you’re free to do whatever you want with the title, and still make your queries be relative to the date of the note.

Possibly use dv.view()

In my daily note setup I’m also using something similar to what you’re aiming for, so my template inserts the following as the first line in my daily notes (and some other notes):

`$= await dv.view("js/header") `

This loads and executes the stuff from within js/header.js. Doing it this allows for me to change the header whenever I feel like it, and all past (and new) daily notes will reflect those changes immediately. Using queries like yours, could very easily be outdated at some point, leaving you with a rather large search-and-replace operation.

However this solution does require a little bit of javascript knowledge, but it also allows for a lot of stuff to be done behind the scenes.

Better date handling in a template

Finally if you start of your template with the following:

---
<%* const today = tp.date.now(""YY-MM-DD") _%>
date: <% tp.date.now("YYYY-MM-DD", 0, today, "YY-MM-DD") %>
... other frontmatter stuff ...
---

You could later on do stuff like:

Yesterday: [[<% tp.date.now("YY-MM-DD", -1, today, "YY-MM-DD") %>]]

Six months ago: ![[% tp.date.now("YY-MM-DD", "P-6M", today, "YY-MM-DD") %>]]

This way you use today as a reference date throughout your template, and you ensure that in any scripts you can do file.day to refer to this date. (If you switch to using the YYYY-MM-DD format for the reference date in the first line, the latter variants could be like tp.date.now("YY-MM-DD", "P-6M", today) and leave out that format string. )