This means that there’s something wrong with tp.file.title and the format you said it would follow in tp.date.now() …
And I guess that this is because you only “name” the new Untitled note with the current date after the frontmatter block in which you already use tp.file.title as the reference date (or something similar)
I can only assume here that your current workflow is to create a “Today’s Daily Note” from an initially “Untitled” note (otherwise, you wouldn’t need a tp.file.rename() anywhere
)
I’ve tested this Templater template (based on your last screenshot), applied to a note titled “Untitled…” :
<%*
// Declare "today"
// Used to rename the note and as a reference date within tp.date.now() (instead of
// tp.file.title)
const today = tp.date.now("YYYY-MM-DD");
//Rename "Untitled" note with "today"
// (only if the note's title is "Untitled...")
if (tp.file.title.startsWith('Untitled')) {
await tp.file.rename(today);
}
-%>
<% "---" %>
tags: DailyNotes
related_to: "[[<% tp.date.now("GGGG-[W]WW", 0, today, "YYYY-MM-DD") %>]]"
aliases:
- <% tp.date.now("dddd Do MMMM, YYYY", 0, today, "YYYY-MM-DD") %>
created: <% today %>
mood:
<% "---" %>
> [!review] Review
> Previous:: [[<% tp.date.now("YYYY-MM-DD", -1, today, "YYYY-MM-DD") %>]]
> Next:: [[<% tp.date.now("YYYY-MM-DD", 1, today, "YYYY-MM-DD") %>]]
> Parent:: [[<% tp.date.now("YYYY-MM", 0, today, "YYYY-MM-DD") %>]], [[<% tp.date.now("GGGG-[W]WW", 0, today, "YYYY-MM-DD") %>]]
<% tp.file.cursor() %>
Which ouput (while renaming Untitled into 2024-01-15) this:
---
tags: DailyNotes
related_to: "[[2024-W03]]"
aliases:
- Monday 15th January, 2024
created: 2024-01-15
mood:
---
> [!review] Review
> Previous:: [[2024-01-14]]
> Next:: [[2024-01-16]]
> Parent:: [[2024-01]], [[2024-W03]]
As you can see, I don’t rely on tp.file.file as a reference date but on the constant today declared at the top of the template (which I use and re-use where needed).
When it comes to the frontmatter block/YAML/Properties the few things to note is that:
-
if a value of a key is a wikilink, the wikilink needs to be quoted
related_to: "[[2024-W03]]"
- instead of
related_to: [[2024-W03]]
-
the aliases key is of type list (which can’t be changed) … So its value(s) needs to be written as such, which can be done 2 ways:
aliases:
- alias 1
- alias 2
- alias 3
… or as an inline array but Obsidian will reformat them as a bulleted list if you interact with Properties
The last thing I’ve spotted in your screenshot is the format used for the “weeks” : "YYYY-[W]" … This would only output 2024-W.
Square brackets are used, in date & date/time format, to escape things that shouldn’t be parsed by MomentJS when the template is applied
. So I changed it and used GGGG-[W]WW instead
.
Now, it would probably easier if you used the Daily Notes core plugin or Calendar and/or Periodic Notes to create your daily notes
… As the daily note would be created where you want it, with the template you want and already titled with “today’s date” (So there would be no need to rename an Untitled... note) 