Help with templater automatization

Hello, I would like some help creating a template for my college notes. I use properties in the following way: date, subject, professor. I would like to know if there is a way to automate the process, where the “Date” property would be the day the note is created, “Subject” would be the third folder in the path, and finally, “Professor” would be the forth folder in the path, as in the following example:

Notes/Clinic/Rheumatology/Alambert/3 - Fibromyalgia

Where:

  • Rheumatology = Subject
  • Alambert = Professor

There are some cases where the folder path is different, such as:

Notes/Gynecology/Claudio/2 - Genital Prolapses

Where:

  • Gynecology = Subject
  • Claudio = Professor

And after the properties, I would like two tags to be typed, where the first is #date and the second #subject/teacher.

Thank you in advance!

i think you can’t do that (putting folders in arrays)… well, you could (do something), but nobody will help you with it…
you need to add a folder name or no folder…

also, i recommend modal forms plugin where you add all your subjects and profs etc.

1 Like

If I understand your question correctly, it’s possible for the three properties like this:

---
date: <% tp.date.now() %>
subject: <% tp.file.path(true).split("/")[(tp.file.path(true).split("/").length)-2] %>
Professor: <% tp.file.path(true).split("/")[(tp.file.path(true).split("/").length)-3] %>
---

And for the tags:

#<% tp.date.now() %>
#<% tp.file.path(true).split("/")[(tp.file.path(true).split("/").length)-2] %>/<% tp.file.path(true).split("/")[(tp.file.path(true).split("/").length)-3] %>

Or, if you put the tags in the properties:

tags:
  -<% tp.date.now() %>
  -<% tp.file.path(true).split("/")[(tp.file.path(true).split("/").length)-2] %>/<% 

Keep in mind that this will only work if the note is already in the right folder.

Exactly that, @Anwen , thank you! Just tested it and works fine :smiley:

Is there any way to change the date format? I use DD-MM-YY.

You juste have to put the format inside the brackets like this : <% tp.date.now("DD-MM-YY") %>. You can check the correct format syntax of the date in that page : Moment.js | Docs.

1 Like

Ty again!

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