Skip to content

How to use different templates depending on how you create a note? #621

Answered by Fertion
Fertion asked this question in Help
Discussion options

You must be logged in to vote

Thanks to AB1908 for helping out on discord.
Final code that does exactly what I need:

<%*
let title = tp.file.title
var TemplateText;
if(title.startsWith("Untitled")) { 
	TemplateText = "Test 1" ; 
} else {
	TemplateText = await tp.file.include("[[TestTemplate]]")
};

tR += TemplateText;
%>

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
4 replies
@Fertion
Comment options

@AB1908
Comment options

AB1908 Apr 20, 2022
Collaborator

@Fertion
Comment options

@AB1908
Comment options

AB1908 Apr 21, 2022
Collaborator

Comment options

You must be logged in to vote
0 replies
Answer selected by Fertion
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
3 participants