Fully dynamic daily notes in Obsidian
Tags: obsidian, notetaking
Published: 2023-02-02 18:16:25

After few months of using [Structured daily/weekly notes - in Obsidian](https://dev.to/michalbryxi/structured-dailyweekly-notes-in-obsidian-2n5h) 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](https://dev.to/michalbryxi/structured-dailyweekly-notes-in-obsidian-2n5h) 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](https://github.com/shabegom/buttons) plugin.

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

`/Templates/Meeting.md`
```md
---
when: <% tp.date.now("YYYY-MM-DD", 0, tp.file.title, "YYYY-MM-DD") %>
tags:
  - meeting
---
<% tp.file.cursor(0) %>
```

`/Templates/Note.md`
```md
---
when: <% tp.date.now("YYYY-MM-DD", 0, tp.file.title, "YYYY-MM-DD") %>
tags:
  - note
---
<% tp.file.cursor(0) %>
```

To explain what is happening here a little bit:
 - The part between the triple dashes (`---`) is [Obsidian frontmatter](https://help.obsidian.md/Editing+and+formatting/Metadata), which uses [YAML](https://yaml.org/) to store metadata about your note.
 - The `when` value uses [Templater](https://silentvoid13.github.io/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`
<pre>
## ✅ 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")
```
​</pre>

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

- The codeblocks used are [button](https://github.com/shabegom/buttons), [dataview](https://github.com/blacksmithgu/obsidian-dataview) and [tasks](https://obsidian-tasks-group.github.io/obsidian-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](https://github.com/SilentVoid13/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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/v8dvc5eqviddu5n385mv.png)

### Meeting

![My Obsidian Meeting note](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ph5pu6ck7637h601bqdb.png)

### Note

![My Obsidian Note](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hkxy0jv6ikyksjqw3jms.png)

---
Photo by <a href="https://unsplash.com/@avonlea_jewelry?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText">Avonlea Jewelry</a> on <a href="https://unsplash.com/photos/HAPRascEqBo?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText">Unsplash</a>