Internal links to previous/next week's notes not working (error)

In my weekly note template I am trying to link to previous/next week’s notes. However I keep getting the error " File name cannot contain any of the following characters: * " \ / < > : | ?" and I cannot figure out the problem after trying different snippets I found in Obsidian forums and adjusting them, and also asking ChatGPT lol. Always getting the same error.

My weekly notes, using Periodic Notes plugin, are formatted as YYYY-[week]-ww (e.g. 2024-week-23) and are in folder 03-Planning/2024 Weekly Notes.

I would really appreciate some help.

Would you mind sharing the part of your template that creates the links to the previous/next week ? :innocent:
(That could be useful)

I tried this one that I found here:

<< [[Calendar/Periodic Notes/Weekly/<% moment(tp.file.title, "YYYY-[W]WW").add(-1, 'weeks').format("YYYY-[W]WW") %>|Last Week]] | [[Calendar/Periodic Notes/Monthly/<% moment(tp.file.title, "YYYY-[W]WW").format("YYYY-[M]MM")%>|This Month]] | [[Calendar/Periodic Notes/Weekly/<% moment(tp.file.title, "YYYY-[W]WW").add(1, 'weeks').format("YYYY-[W]WW") %>|Next Week]] >>

I tried entering my own weekly notes path (03-Planning/2024 Weekly Notes) and fiddled with the format, but I always get the same error.

And you’re applying the template using the Templater community plugin (not the Template core plugin) ? :thinking:
(When you create your daily note)

I am using the core-plugin. Should I use the community one?

Nevermind, I found a snippet that works:

←[[{{date-1w:YYYY-[week]-ww}}]] | [[{{date+1w:YYYY-[week]-ww}}]]→

Yes :grin: !

The <% .... %> is Templater’s syntax (the community plugin) which can only be used with Templater :blush: .

After installing and enabling Templater, in its settings, you might also need to toggle On the setting Trigger Templater on new file creation.

1 Like

Ah ah ah :smile: !
Our messages crossed each other :joy: !

Glad to know you’ve found a way to make it work :raised_hands: :grin: !!!

1 Like