Run metaedit against the tile being created file using templater?

What I’m trying to do

I wanted to start building templates on top of each other. I though that doing simple includes will be enough, but I want to be able to append values to values defined in previous templates.
So, if I have a base template with the frontmatter property tags empty, I want a derived template of contact to append the tag contact. And, if I create a new derived template that is a important contact, I want a third template to append the tag important to the tags defined in the previous two templates.

All during file creation making use of the templater feature that runs a template on file creation. Is this possible? makes sense? is there a better way?

Things I have tried

This is the template code I’ve tried (among other variations)

const base = await tp.file.include('[[templates/default]]') 
const {update} =["metaedit"].api;
const file = tp.config.active_file;
const temp_file = await tp.file.create_new(base,'tmp/salud');
await update('tags', 'tmp/salud', file);
await tp.file.move(tp.config.target_file.path, temp_file);

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