[[display_title]] in New Draft with Template Action

I’m attempting to modify Greg’s New Draft with Template action to use the [[display_title]] tag instead of the straight title because having the markdown # in each button makes me crazy (or maybe I’m already crazy, and this is just it manifesting).

I’m trying to add a line in the for loop that creates the prompt buttons, and my button titles are coming up blank. Here is what I’ve written:

let ix = 0
for (let d of drafts) {
	var title = d.getTemplateTag("display_title");
	p.addButton(title, ix);

I would think my getTemplateTag line would work, but my buttons are all coming up blank. Any suggestions on how I could remedy this?


That’s for use with custom tags. Try this instead.

var title = d.processTemplate("[[display_title]]");


I have always struggled with the difference between processTemplate and getTemplateTag. Combine that with it having been awhile since I have written a script for Drafts, and I wasn’t going to get there on my own.

1 Like