I just wanted to illustrate the principle in that example. To have multiple prompts for multiple themes / topics, I would adapt this Infinite prompt until no value snippet from @Zachatoo like so:
<%*
tp.hooks.on_all_templates_executed(async () => {
let allTopics = [];
let isAddingTopic = true;
while (isAddingTopic) {
const topic = await tp.system.prompt("Want to define parent topic?");
if (topic) {
allTopics.push(topic);
} else {
isAddingTopic = false;
}
}
const properties = [
{key:'parent_topic', value: allTopics},
];
await tp.user.merge_frontmatter(properties, tp);
});
-%>
With this, you can enter as many themes as you want. When you are done, either use escape or press enter without writing an input. This ends the loop, and your input values are then added to the properties. I’ve tested this, and it seems to work well In action:
Thanks for the advice, I’m making progress on this and will share the refactored userscript when I’m done. I think it will include the ability to specify the update behavior as mentioned before. This could either be done on a per-property basis in the properties array, or as a global setting that affects the treatment of all properties in the array.
Thanks for the link! Even without it, Holroy’s advice did come in handy, though