Code block in template

I recently started using obsidian and still have a lot to learn. I installed templater plugin and pasted in a codeblock the code that first asks what title should a note have

  let title = tp.file.title
  if (title.startsWith("Untitled")) {
    title = await tp.system.prompt("Title");
    await tp.file.rename(title);
  tR += "---"

If I open a new file with templater and I choose the aware template, the codeblock works, it asks for a file name, but otherwise the new note is then completely empty, while there are other things in the aware template.

What am I doing wrong?

It won’t work unfortunately…

Ah cool, i found out to put the code in — (add three times - above and beneath code)



It was the filename head sync plugin that ruins my template.