Obsidian meta template for inbox selection

I use Templater plugin and needed a quick way to select proper inbox (or current folder) at file creation time.

This is a meta-template.md which is set as a default template in the Templater settings. It sets proper file location and includes relevant template file.

<%* let inboxType = await tp.system.suggester(["System", "Life Admin", "Treasure Trove", "Current folder", "CTF"], ["System", "LA", "TT", "CF", "CTF"], false, "Which location/type do you want to use?"); _%>

<%* let laInboxes = ["10 ■ Life Admin/10.01 Inbox/",
"11 Me & other living things/11.01 Inbox/",
"12 Where I live & how I get around/12.01 Inbox/",
"13 Money earned, saved, owed, & spent/13.01 Inbox/",
"14 My online life/14.01 Inbox/",
"15 Travel, events, & entertainment/15.01 Inbox/"
]; _%>

<%* let ttInboxes = ["20 ■ Treasure Trove/20.01 Inbox/",
"21 Brain/21.01 Inbox/",
"22 Learning/22.01 Inbox/",
"28 Crafts library/28.01 Inbox/"
]; _%>

<%-* if (inboxType === "System") { -%> 
  <%_ tp.file.include("[[default]]") _%>
  <%_ tp.file.move("00 ■ System/00.01 Inbox/" + tp.file.title) _%>
<%-* } else if (inboxType === "CF") { -%>
  <%_ tp.file.include("[[default]]") _%>
<%-* } else if (inboxType === "LA") { -%>
  <%_* let subInbox = await tp.system.suggester(laInboxes.map(i => i.split('/')[0]), laInboxes, false, "Which LA inbox do you want to use?") -%>
  <%_* if (subInbox) { -%> 
    <%_ tp.file.include("[[default]]") _%>
    <%_ tp.file.move(subInbox + tp.file.title) _%>
	<%* } -%>	
<%-* } else if (inboxType === "TT") { -%>
  <%_* let subInbox = await tp.system.suggester(ttInboxes.map(i => i.split('/')[0]), ttInboxes, false, "Which TT inbox do you want to use?") -%>
  <%_* if (subInbox) { -%> 
    <%_ tp.file.include("[[default]]") _%>
    <%_ tp.file.move(subInbox + tp.file.title) _%>
  <%* } -%>	
<%-* } else if (inboxType === "CTF") { -%>
  <%_ tp.file.include("[[ctf-template]]") _%>
  <%_ tp.file.move("22 Learning/22.CYB Cyber/" + tp.file.title) _%>
<%* } -%>

output

2 Likes