Meg's Default Template #259
Replies: 10 comments 19 replies
-
Thank you! I could not figure out how to avoid an extra lines at the top of my script :) |
Beta Was this translation helpful? Give feedback.
-
Here's a cleaned up version 😀
|
Beta Was this translation helpful? Give feedback.
-
As I understand it, from our point of view tR already exists (so we don't have to declare it) -- it's the replacement string/return value created by the Eta template language used by Templater... From the documentation:
|
Beta Was this translation helpful? Give feedback.
-
This is a great example to get started @megclaypool - I have one issue/question though and am wondering if anyone else has experienced this. I get two prompts for the title. The input of the second prompt is then used. I can't wrap my head around it. Any help would be appreciated. |
Beta Was this translation helpful? Give feedback.
-
How did you actually implement this (and yes, I am a noob to Obsidian). Sorry if this seems obvious, but it is not for me. |
Beta Was this translation helpful? Give feedback.
-
Is there way to check empty prompt and replace with something by default? |
Beta Was this translation helpful? Give feedback.
-
Thanks for this template. I have some questions about it. I am new to this so I hope you can help me. Thanks |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
Thanks for this Meg 😃 I found that cursor jump is not working anymore i.e. Using following instead for rescue: My default template:
|
Beta Was this translation helpful? Give feedback.
-
This is how I do it using Whitespace Control and Script User Functions async function promptTitle(tp, journalType){
let title = tp.file.title;
if (title.startsWith("Untitled")) {
title = await tp.system.prompt("Title?");
}
if(journalType){
title = `${tp.file.creation_date("YYYY-MM-DD")} - ${journalType} - ${title}`;
}
await tp.file.rename(title);
return title;
}
module.exports = promptTitle; <%* let title = await tp.user.promptTitle(tp, "Meeting"); -%>
---
title: <% title %>
tags:
- log/meeting
--- |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I use this as my default template. If I created the page by clicking a previously unresolved link, it uses the link title as the page title. If it's just a new page, it'll prompt for the title. Then it fills in the page info with the title and creation date:
('m outputting the triple dash with the templater return to avoid an extra line at the top of my page)
Beta Was this translation helpful? Give feedback.
All reactions