How to insert tags from previous note that is not in frontmatter

What I’m trying to do

I want to create a template which I use for notes in a project. In this template I want to insert tags which are in the previously opened note. Meaning if the “master note” of the project has the tag “group” the same tag is inserted in the new note. With the script below I am able to do this if the tags are in the frontmatter (between the two “—” lines, but not if the tags are later in the document as “group::”

Things I have tried

This template works if the tags are in the frontmatter:

let title = tp.file.title
if (title.startsWith(“Untitled”)) {
title = await tp.system.prompt(“Title”);
todaysDate =“YYYY-MM-DD HH:mm”);
let files =;
let lastFile =[0]); // t file
// Collects frontmatter of other note
var get_frontmatter =
)?.frontmatter || {};
title: <%* tR += title %>
project: <%* tR+= lastFile.basename %>
created: <% todaysDate %>
noteType: note
group: <% %>

<%* tR += title %>

<%* tR+= Parent note: [[ + lastFile.basename +]] %>

<% tp.file.cursor(1) %>

How can I create something which inserts tags in the “master note”, where the tags are not in the frontmatter, but inserted within the note as for instance “group:: group1”?

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