Wanted to share a workflow for automatically linking back to the parent note when you’ve created a new note by typing [[Note name]] into a parent note and clicking the link.
There are a few other workflows shared on the forum, but they use multiple plugins. This workflow is simpler. It just uses the templater plugin.
Insert this text into your template:
<%*
const parentFile = tp.file.find_tfile(tp.app.workspace.getLastOpenFiles()[0]);
const parentLink = tp.app.fileManager.generateMarkdownLink(parentFile, tp.file.folder(true));
-%>
<% parentLink %>
In the Templater settings, enable “Trigger Templater on New File Creation” and “File regex templates”. Add these two file regex (in this order):
- c.*Untitled.* → link to a template without the formula to avoid new notes not created from a parent from linking to a random note
- .* → link to template with the formula to have all other new notes


