In this my hope is for it to pull the contents of my daily journal using Transclusion.
In this way, when I write my Weekly Journal entry, I’m not forced to go and copy/paste each of my Daily Journal entries into the Weekly Journal – it simply shows the daily entries there automatically.
To achieve this, I’m using the Templater plugin which allows me to use: <%+ tp.date.now("YYYY-MM-DD") %>
This expresses as: 2023-05-22
If I then instead use: ![[<%+ tp.date.now("YYYY-MM-DD", -6) %>]]
My hope was that the weekly note would look for a note named: “2023-05-22” and show it’s contents using Transclusion
When I switch to reading mode, it does in fact say: “2023-05-16” is not created yet. Click to create."
This to me looks like success! Because I figured that if I simply had a note named “2023-05-22” it would show it’s contents.
However, when I created such a note, it still showed “2023-05-16” is not created yet. Click to create." and when I clicked it, it instead tried to create a new note with the title: “<%+ tp.date.now(“YYYY-MM-DD”) %>”
You can insert the contents of a file with the syntax:
![[file to reference#heading to reference]]
So for example if you want the heading “Bar” from the file Foo, you would write: ![[Foo#Bar]]
An example how I’m using it. I have weekly notes (using the Periodic Notes plugin, though that doesn’t matter) with files like 2023-W20. So the year and the W and weeknumber. In that file I have several headings, one of them:
## Aandachtspunten 2023-W20
Under this heading there is a list of things I want to remember like sleeping more regularly or working out more, etc.
This is the file format I explained above. I’m using the built-in moments.js to get the filename and heading name filled in. This syntax takes the name of the file (format yyyy-MM-dd) as base, then calculates the start of the week and formats it in the format 2023-W20 in this example. The whole thing is in there twice as both the file is 2023-W20 in this case as the heading which is ## Aandachtspunten 2023-W20
Now on each Daily Note (I call it Daily Journal) my 3-5 points I have added in my Weekly Note is transcluded.
I don’t use the tp.date.now() format as my approach also works when I have missed a week for any reason. As long as the Daily Note has the correct date in its filename, it will reference the correct Weekly Note linked to it.
EDIT: you can leave the heading out of the link, so ![[file]] works as well, then you get the whole file.
I did however have trouble implementing it, I even took your description and my question to ChatGPT to try to make sense of why it isn’t working.
The first problem I have I suppose is that we’re doing the opposite of one another.
I’d like to have a Weekly Journal Template which creates me a Weekly Journal entry titled in the 2023-W20 format, which automatically transcludes the entire Daily Journal for every day within that week, so 2023-05-15 through 2023-05-21.
My thinking of how it would work, is that when I create the Weekly Journal, the code will look at the title, being “2023-W20” and then calculate the seven required transclusions, and they’d need to be formatted as: “![[2023-05-15]]” and so on.
However, in an effort to try to better understand your way of doing things, I tried to replicate your method verbatim and came across an error, which stated:
" <% moment (tp. file.title, ‘yyyy-MM-dd’).startOf(‘week’).format(‘999g-[W]ww’)
%>#Aandachtspunten <% moment(tp. file.title, ‘yyyy-MM-dd’).startOf(‘week’).format(‘gggg-
[Www’) %>" is not created yet. Click to create.
I think a problem you are having is you are using dynamic templater commands whereas you should be using execution commands instead. That way when you create your weekly note it will actually insert the text rather than just displaying it to you.
I do the same thing in my weekly journal. I can add an example later to show you how I manage it if you still need the help.
To further exoand upon the last response; Templater works in three different modes, and this is controlled by the leading characters of your template block:
<% – The normal variant, which I think you should be using on this case. Here the template will be replaced when you insert the template (or create a file based upon the template)
<%+ – This kind of template blocks are kept as is into the resulting file, and are expanded when you enter reading mode (and not live-preview). Doing this within a link text, is somewhat sketchy and can result in malformations like you’ve already experienced.
So remove the plus sign from your template, and most likely it should work just nicely, and you’ll embed your daily notes from that weekly summary.
As you can see in the screenshot below, the code I’m using is working perfectly except that it’s titling each section with “Monday” instead of providing the correct day of the week, for the subsequent block.