Can you please share some of your templates?

They are basic templates but it’s the point of this project.

2 Likes

My main template is:

<%*
  let default_title = tp.file.title;
  let title = default_title;
  if (title.startsWith("Untitled")) {
    try{
	    title = await tp.system.prompt("Title");
	    if(title==="" || title === null){
		    throw new Error("Title is empty or null!")
	    }
    }
    catch(error){
		console.error("Enter or Esc was pressed on prompt:", error)
	    title = default_title;
    }
    finally{
	    await tp.file.rename(`${title}`)
    }
  } 
  tR += "---"
%>
created:<%tp.date.now("YYYY-MMM-DD")%>
---

<HR style="border-color: RGBA(139, 108, 239 ,0.75)">

<%tp.file.cursor()%>




<HR style="border-color: RGBA(139, 108, 239 ,0.75)">

[[## SYSTEM TAGS|]]
#<%title[0].toUpperCase()%> 

I added some try-catch block in the begining of my template, because if I trying to rename title and pressed just Enter(title=“”) or Esc(title=null), template not working, obsidian creates just some empty file.
So now tempate is working how I want)