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 %>