How do i identify which notes link to the current open note

Lets say we have the following page that has two links:

- Project note
-- [[Task 1 note]]
-- [[Task 2 note]]
  • The Project note is the main note related to a specific project

  • The Task notes are links to other notes which logically are children of the Project note. i.e subnotes of the main project note.

  • The Task note links are created using a Quick add short cut that does the following:

    • Create a new note using a an existing template (Task note template)
    • Creates the link in the current active page (Link to the newly created Task Note)

What i would like to achieve is that when a new Task note is created, the template adds a new frontmatter property that points back to the parent note (Project note) - i.e the note in which the task note link resides in.

Looking at the note footer of the Task notes, i can see that the parent note is referenced in the Linked mentions section. Is there a way i can get the value of the parent note’s name so that i can add it as a YAML property in the child page (task note)?

The objective here is that the parent note determines what project the child notes belong to. When looking at a child note, i would like to know which project they belong to (i.e which project note is the link to the current note located in). If i have this value as a frontmatter then i can use it in tables, DB Folder etc.

Any help would be appreciated.

Note - I have seen some examples that provide this but these are based on dataview

Example 1

LIST FROM [[#]]

Example 2

table without id link(file.link, title) as "title", date where contains(this.file.inlinks, file.link) sort date desc

The above examples work but how can i use the output of the above as a value for a property in the YAML? Is there a way to get the same result using JS which i can use in my template?

I tried the below but both come back as “undefined”
project: <% tp.file.inlinks %>
project: <% dv.current().file.inlinks %>

One approach to solving this is to insert the link to the parent note as part of the template for the task note. You should then be able to know which note is the parent note, and insert a link to it. How this look depends on what kind of template engine you’re using, but in theory most template engine should support this concept.

One approach to solving this is to insert the link to the parent note as part of the template for the task note.

Do you mean manually? This is what i am trying to do but i cant work out how to identify the parent note (there are multiple parent notes) from the task note template.

How this look depends on what kind of template engine you’re using

I am using Templater

Then you should be able to use tp.config.active_file in your template as that’s where you started creating the new task from.

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