Templater script help

I’m trying to create a template that lets me create a “Tomorrow Note” file. I’m currently using this setup:

Pasteboard - Uploaded Image Template

Pasteboard - Uploaded Image Output

But this has 2 main problems:

  1. The file gets created on the root of the vault, but I would like to get it inside my daily notes folder, following the correct file order (3. Daily/YYYY/MM/note) 2. The template doesn’t apply to the file it creates, but I believe it could be related to the first issue, since the templates applies to the “3. Daily” folder

I’m a complete beginner with Obsidian but I do have some coding knowledge. Any help would be much appreciated as have been struggling with this for almost a week now.

Hello, hopefully this information is helpful!

Settings

1.) Ensure that trigger template on file creation is enabled

That is the most important issue and likely the error of confusion

2.) Set up the folder template setting

In order to trigger template usage based on directory, make sure this is configured. The input on the left is the chosen directory (in your case its “3. Daily”), and the right input is the template

Ensure to be case sensitive and end with “.md” when referencing a template

3.) Ensure your templates folder is set up

Usage

Now, whenever a file is created in the daily directory, it will follow the template (regardless of using the daily note button.)

I use this format for my links

# [[3. Daily/<% tp.date.now("YYYY/MM/DD-MM-YYYY-dddd", -1) %>|⋘]] [[<% tp.date.now("YYYY/MM/DD-MM-YYYY-dddd") %> |<% tp.date.now("MMMM DD YYYY") %>]] [[3. Daily/<% tp.date.now("YYYY/MM/DD-MM-YYYY-dddd", +1) %>|⋙]]

It will appear like this,

image

If you’d like to keep your original, all you need to do is change it to this,

<<<[[3. Daily/<% tp.date.now("YYYY/MM/DD-MM-YYYY-dddd", -1 %>]] | [[3. Daily/<% tp.date.now("YYYY/MM/DD-MM-YYYY-dddd", +1 %>]]
3 Likes

Thank you so much!
I was reallly struggling with this.

I want to ask you if it is considered normal behaviour the fact that when i click on the button to go to the day after tomorrow nothing happens.
immagine
If i click on the arrows, nothing happens.

Thank you so much anyway, as this is just a curiosity and it doesn’t bother me at all.

The ⋘ and ⋙ symbols are singular unicode symbols. Though the design has three ticks, its only one symbol and it cannot direct you to multiple places

If you want the link to include the day after tomorrow, here’s an alternative format

[[3. Daily/<% tp.date.now("YYYY/MM/DD-MM-YYYY-dddd", -3) %>|<]][[3. Daily/<% tp.date.now("YYYY/MM/DD-MM-YYYY-dddd", -2) %>|<]][[3. Daily/<% tp.date.now("YYYY/MM/DD-MM-YYYY-dddd", -1) %>|<]] [[<% tp.date.now("YYYY/MM/DD-MM-YYYY-dddd") %>|<% tp.date.now("MMMM DD YYYY") %>]] [[3. Daily/<% tp.date.now("YYYY/MM/DD-MM-YYYY-dddd", +1) %>|>]][[3. Daily/<% tp.date.now("YYYY/MM/DD-MM-YYYY-dddd", +2) %>|>]][[3. Daily/<% tp.date.now("YYYY/MM/DD-MM-YYYY-dddd", +3) %>|>]]

image

or if the original is too weird or confusing you can replace the symbol with <> like so,

[[3. Daily/<% tp.date.now("YYYY/MM/DD-MM-YYYY-dddd", -1) %>|<]] [[<% tp.date.now("YYYY/MM/DD-MM-YYYY-dddd") %>|<% tp.date.now("MMMM DD YYYY") %>]] [[3. Daily/<% tp.date.now("YYYY/MM/DD-MM-YYYY-dddd", +1) %>|>]]

image

Thank you again, I have one last request:
Would it be possible to have the date in the center display the actual date of tomorrow etc instead of the date it has been created?
Thank you so much already.

Hello, @strepito66 !

In order to match up templater replacements with the actual file date is by adding these values to date referencing placeholder in your templates

, 0, tp.file.title, "YYYY/MM/DD-MM-YYYY-dddd"

or

tp.file.title, "YYYY/MM/DD-MM-YYYY-dddd"

If an offset is already set

This would look like,

🚫 title: <% tp.date.now("MMMM DD YYYY") %>
✅ title: <% tp.date.now("MMMM DD YYYY", 0, tp.file.title, "YYYY/MM/DD-MM-YYYY-dddd") %>

🚫 title: <% tp.date.now("MMMM DD YYYY", -1, 0, tp.file.title, "YYYY/MM/DD-MM-YYYY-dddd") %>
✅ title: <% tp.date.now("MMMM DD YYYY", -1, tp.file.title, "YYYY/MM/DD-MM-YYYY-dddd") %>

Using the samples I gave you, this is how things would look,

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.