DEV Community

Cover image for Fully dynamic daily notes in Obsidian
Michal Bryxí
Michal Bryxí

Posted on • Updated on

Fully dynamic daily notes in Obsidian

After few months of using Structured daily/weekly notes - in Obsidian I collected enough information & knowledge to improve the system.


The problems

  1. The tasks under "Work" are just inline tasks that are attached to that one note and I:
    • Found myself copy&pasting heap of tasks from yesterday to today. Everyday.
    • Forgetting some tasks in previous days and losing track about them.
    • Having to explicitly [[Link]] project that was related to given task.
  2. Not being able to create ad-hoc - [ ] Task in some note and have it automatically visible in Today's note.
  3. Not being able to create tasks for future days. The note for that day would need to exist, which is a bit of a pain.

The challenge

  1. Part of my improvement was the idea that a daily note can be destroyed & recreated at any time and no information can be lost.
  2. I'm not a fan of "manual" things so solution has to be as convenient as possible.
  3. And obviously given solution should cover all the flaws listed above.

The solution

Quite a bit from my previous article stayed the same, so feel free to use it as reference on what plugins to install, what folders create and which settings to tweak. Without this step, you might get varying results.

To make note creation convenient for myself I installed also Buttons plugin.

Meeting nad Note templates

These are fairly simple templates to quickly create Meeting and generic Notes.

/Templates/Meeting.md

---
when: <% tp.date.now("YYYY-MM-DD", 0, tp.file.title, "YYYY-MM-DD") %>
tags:
  - meeting
---
<% tp.file.cursor(0) %>
Enter fullscreen mode Exit fullscreen mode

/Templates/Note.md

---
when: <% tp.date.now("YYYY-MM-DD", 0, tp.file.title, "YYYY-MM-DD") %>
tags:
  - note
---
<% tp.file.cursor(0) %>
Enter fullscreen mode Exit fullscreen mode

To explain what is happening here a little bit:

  • The part between the triple dashes (---) is Obsidian frontmatter, which uses YAML to store metadata about your note.
  • The when value uses Templater value to extract date (YYYY-MM-DD from current file name). This template will be executed on file creation. It might seem redundant as I could then use the file name directly in queries, but for me files are meant to be renamed to have more meaning.
  • The tags: - meeting is to mark the type of this note for future use.

Daily template

/Templates/Daily.md

## ✅ Today


```tasks
scheduled on {{date:YYYY-MM-DD}}
hide scheduled date
hide done date
```


​
## ⏰ Past


```tasks
((not done) OR (done on {{date:YYYY-MM-DD}}))
(scheduled before {{date:YYYY-MM-DD}})
```


​
## ☎️ Meetings


```button
name New Meeting
type note(Meetings/<% tp.date.now("YYYY-MM-DD", 0, tp.file.title, "YYYY-MM-DD") + ' - ' + '\<\% tp.date.now("X") \%\>' %>, split) template
action Meeting
templater true
```


​


```dataview
TABLE join(file.outlinks) AS Outlinks
WHERE when=date(this.file.name) AND contains(tags, "meeting")
```


​
## 📝 Notes


```button
name New Note
type note(<% tp.date.now("YYYY-MM-DD", 0, tp.file.title, "YYYY-MM-DD") + ' - ' + '\<\% tp.date.now("X") \%\>' %>, split) template
action Note
templater true
```


​


```dataview
TABLE join(file.outlinks) AS Outlinks
WHERE when=date(this.file.name) AND contains(tags, "note")
```


​

This one is a bit more complex, so let's dive in:

  • The codeblocks used are button, dataview and tasks. The last one could be replaced with dataview, but I find tasks more flexible.
  • Tasks block Today shows all tasks scheduled for today.
  • Tasks block Past shows all unfinised tasks scheduled for any date in the past.
  • Button New Meeting creates new meeting note using given template. First part uses current (Daily) note file name, which will be by default in YYYY-MM-DD format to get the same to new note name. The curious thing is the extra escaping of the templater syntax on the next part. This is because we are looking at a template that is going to be used to create Daily Note. And inside this we want to have another template that is then being used to create a pseudo-random addition to the note name - current unix timestamp. This is because buttons can't create notes that already exist, so we need some differentiation.
  • Dataview block under Meetings then shows all Meeting notes for given day & as a quick reference also lists all the outlinks from that note, which is quite handy for quick overview of that meeting.
  • Button & Dataview block for Notes is very similar to those from Meetings.

Rationale

  • I find it handy to display all tasks scheduled for today as well as those scheduled for the past all the time, so that I can keep track of all the overdue items.
  • Meetings & Notes are created with unix timestamp in their name only for the sake of file name collision. First thing I will rename them.
  • Although I could query by filenames, Meetings & Notes do have the when metadata included, because I assume that at any point in time I can decide to rename them, so I don't want to lose the relationship to the calendar.
  • All meetings live in a /Meetings/ subfolder. Notes are just any generic ideas I need to write down. But I still do want it to be attached to a day.
  • Displaying Outlinks in the Meetings & Notes is quite handy for quick context awareness.

Screenshots

Daily

My Obsidian Daily note

Meeting

My Obsidian Meeting note

Note

My Obsidian Note


Photo by Avonlea Jewelry on Unsplash

Top comments (9)

Collapse
 
divaksh profile image
Divaksh Jain

{{date:YYYY-MM-DD}} placeholders will not work for Templater community plugin, it works with Template Core plug-in.
Use <% tp.date.now(“YYYY.MM.DD”) %> instead for the Templater community plugin.

Collapse
 
newhigen profile image
newhigen • Edited

Thanks for the great post!
This is exactly what I wanted do XD (collecting daily note into weekly automatically with each block viewed collectively)
Just a small addition to your post. I spend a bit of time as tasks did not render until I found out tasks plugin is required. Adding 'tasks' into the required plugin will be more helpful for others too.
Anyways, totally loved your style of writing in detail: how-to, screenshots, and why!

Collapse
 
michalbryxi profile image
Michal Bryxí

😊 Happy that the post was useful. It's awesome to see that in some way or the other it's useful to someone 💫

Thanks for the feedback, will add the plugin to the list.

Collapse
 
kiligfei profile image
Kilig

Hello, can you share a template warehouse? Thank you

Collapse
 
michalbryxi profile image
Michal Bryxí

I'd be happy to do it, but no idea what does "template warehouse" refer to?

Collapse
 
kiligfei profile image
Kilig

Thank you for your sharing. As someone with limited understanding of coding, I spent some time attempting to achieve the effects mentioned in your post but without success. It would be greatly appreciated if you could provide a configuration document that is easy to use—just a simple copy and paste, with the option to make minor adjustments based on individual needs. While I understand this may require some effort on your part, I truly appreciate it.

Thread Thread
 
michalbryxi profile image
Michal Bryxí
Thread Thread
 
kiligfei profile image
Kilig

You're greatly appreciated.

Collapse
 
mjne profile image
JNE

Hi, I am new to Obsidian. I have tried to open the zip folder as a brand new vault. I, however, encounter the following errors. Not sure what is wrong? The template is amazing btw!

Image description

Image description

Image description