Autopopulate Properties in templater, how to find another file or files to pull into a property as a link

What I’m trying to do

Some of the content in my vault is dependent on being able to be explicitly queried in dataview.
I don’t have much of a taste for excalidraw personally, but the siblings, and parent data fields (not friends or children), are things I’d like to populate automatically when I first insert templates to help organize notes without me typing all these explicit relationships in.

As a note, this only applies to some of my vault, mostly the part that’s centralized on locations.
These notes have a Type property containing “[[Places]]”.

My goal is to be able to autopopulate new notes I create with these kinds of relationships, namely Parents and Siblings, to prevent myself from having to type these relationships over and over again.

I’m thinking templater has my solution, but I’m not super technical and am hoping for some help. For data population, there’s actually a function? for this on the templater documentation, but a lot of the tutorials only really show you how to use dates.

What I’ve tried

If I use the code:
tp.hooks.on_all_templates_executed(async () => { const file = tp.file.find_tfile(tp.file.path(true));
await app.fileManager.processFrontMatter(file, (frontmatter) => { frontmatter[“Parents”] = “[[FileThatIsTheParent]]”;});

I get the result I want, but there’s a part of it missing that I’m struggling with for just general lack of technical understanding on my part. What this needs in supplement is:

how to get a file that has a property equal to the link to the current file.
Find a File whose property (The specific property is Children) contains this file’s link.

Appreciate any insight y’all have. Thanks!

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