Link to Weekly Note from Daily Note using the template
Closed this issue · 5 comments
(cross posted to the forum here)
This might be a obvious question but the answer isn't making sense to me, so here goes:
How can I add something to the Daily Notes Template file which links to that week's Weekly Note?
As in:
(Daily Notes Template File)
# {{date:MMMM D, YYYY}} Work Journal
tags: #work_journal
## Weekly Goals
(I want to autogenerate this preview link below, pointing to the first day of the week)
![[2023_03_05_weekly_note#Weekly Goals]]
## Today's Goals
1. text
## Journal
- text
## Tomorrow's Priorities
1. text
I don’t know about native to this plugin, but you can achieve this goal with Templater.
For reference: I name my periodic notes with ISO date conventions:
- Daily Notes:
2023-03-09
- Weekly Notes:
2023-W10
In my Daily Note template, I have the following Templater code:
[[<%tp.date.now("GGGG-[W]WW", 0, tp.file.title)%>]]
It uses the templater tp.date
module to:
- First argument:
"GGGG-[W]WW"
format a date in the ISO week style - Second Argument:
0
add/subtract 0 days to the date - Third Argument:
tp.file.title
Us this file’s title as the date to format (not “now’)
So a note named 2023-03-09
will have that date reformated to 2023-W10
.
And I stuff all of that between [[
and ]]
to make it a link.
Actually I see for you original question that you maybe just want one header. TBH the code above is simplified, I actually have:
![[<%tp.date.now("GGGG-[W]WW", 0, tp.file.title)%>#What are this week’s big three Plan for Success|Review this week’s Big Three]]
Which transcludes a Header Section from my Weekly note into my Daily Note.
Did you enable Templater? It looks like the template code <% … %>
is not being executed.
I figured it out.
I needed to enable "Settings > Templater > Trigger Template on new file creation".
At which point this gave me what I wanted:
![[<% tp.date.weekday("YYYY_MM_DD", 0) %>_weekly_note#Weekly Goals]]
which generated
![[2023_05_21_weekly_note#Weekly Goals]]
My guess is there are two templating actions (with different formats) happening in Periodic Notes:
- The Periodic Notes plugin templating replacements (e.g.
{{date:YYYY-MM-DD}}
format) - The Templater plugin replacements, (e.g.
<% tp.date.weekday... %>
) which won't kick in when using Periodic Notes unless you enable the above trigger
So with the Templater trigger set, I can mix them both in my daily notes template file:
# {{date:MMMM D, YYYY}} Work Journal
tags: #work_journal
![[<% tp.date.weekday("YYYY_MM_DD", 0) %>_weekly_note#Weekly Goals]]
## Daily Goals
1.
## Journal
- text
## Tomorrow's Priorities
1. text
## Todo List Log
Note: Hat tip to @I-Dont-Remember in this blog post for pointing out there are separate templating actions occuring.