Conditionally adding content to my Obsidian daily note with the Templater plugin
I wanted to add some work startup/shutdown checklists to my daily note in Obsidian, but I didnโt want them going in on the days I donโt work. It turns out this is possible with the Templater Plugin.
Templater essentially gives you the ability to run some JavaScript when a note is created via a template. This means you can conditionally change the content of your note depending on variables such as the current date or time.
In my daily note template, I check for the day name, and then add the checklists if it is one of my work days. It looks like this:
# <% tp.date.now('dddd') %>
<%* const day = tp.date.now('dd');
const dayIsWorkday = (day == 'Tu') || (day == 'We') || (day == 'Th') || (day == 'Fr');
if (dayIsWorkday) { %>
## ๐ Workday start checklist
- [ ] Slack notifications
- [ ] Notion notifications
- [ ] GitHub notifications
- [ ] Make today's list
- [ ] Get crushing
## โ๏ธ WORK TODO
- [ ]
<%* } %>
## ๐ Log
-
<%*if (dayIsWorkday) { %>
## ๐ด Shutdown routine
- [ ] Progress notes
- [ ] Update Notion cards
- [ ] Toggl track
- [ ] Quit all
<%* } %>
## ๐ Notes created today
```dataview
LIST FROM "notes" or "projects"
WHERE file.cday = this.file.day
```
Comments
Jake Weidokal
January 12, 2024 at 11:51 AM
Very neat! I'd love to see more about how you manage tasks in Obsidian! I've been using it for tasks for half a year now and really enjoying it. I'd like to share my setup soon.
xix
January 16, 2024 at 2:52 PM
thank you for your sollution about Astro and obsidian
Leave a Comment
๐ฏ Thanks for submitting your comment! It will appear here after it has been approved.