Running Scripts with Templater

i have a script that i use for QuickAdd that fetches yaml and uses it in capturing stuff. i need to also use it for Templater plugin to do the same thing but i doesn’t work and give me an error in console. can someone please help me? the code i am using is this and i am calling it with a template like this: <% tp.user.CitationShort() %>

and the code in CitationShort.js is:

module.exports = (params) => {
	const activeFile =;
	if (!activeFile) {
		new Notice("No active file");
		throw new Error("No active file");
	const myvar01 = app.metadataCache.getFileCache(activeFile);
	const myOutput = myvar01.frontmatter.citshort
	if (!myOutput) {
	new Notice("ٍError");
	throw new Error("Error");
	return myOutput;

what i am doing wrong. i guess maybe the use of export module is different in Templater but i am too new to these stuff to find out. if this work i can use yaml to so a lot of stuff which can solve a lot of my problems with it

What’s the error?

1 Like

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