Templater: Search for file based on tags and creation date, then put matched filename into note

What I’m trying to do

I am trying to create a template for creating project notes to serve as logs to track the project’s progress. I would like the template to create the following string at the top of the file:

[←](matched_file.md) [Index](23199drx.md) [→](.md)

where matched_file should be the file name of the previous project markdown note for this specific project. The idea is that, in this way, I would be able to easily travel to the previous project note directly without having to pass by the “index” note to look it up.

Regarding the way to search for the correct file name of the previous project note, I use tags of the form project/this, project/that, etc. to know which notes belong to a given project. So, I thought that creating a function to look for the creation date and the presence of the tag project/this could be useful to determine which note would be the previous note to a given project. (Btw, my template for creating project notes already prompts the user to specify the project a note belongs to. Then, this info is saved into the variable project. Therefore, this variable could be passed to the function to look for the project note that matches that tag).

Finally, it would be awesome if the template was able to look for the string [→](.md) in the matched previous project note file, and replace that string with [→](new_file_name.md).

Things I have tried

Sorry, my knowledge of JavaScript is very limited, so I can’t even imagine what the functions to do this would be like.

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