RyanParsleyDotCom

Daily notes with zk

While Obsidian is great, lately I’ve been considering how to get similar affordances with alternative tools. zk looks like a nice tool to consider for a more cli driven workflow. In this post, I explore the configuration of zk to approximate the daily note workflow I currently have set up with Obsidian.

What does the template look like?

For personal stuff, I use a daily note to track habits and capture fleeting notes during and about a given day. I don’t want to give the file a name or come up with a clever title each day. I also want to have some frontmatter attributes ready for consistent tracking of daily habits like meditation and playing clarinet.

---
title: {{format-date now '%Y-%m-%d'}}
created: {{format-date now '%Y-%m-%d'}}
clarinet: false
meditate: false
tags:
  - daily
---
# {{format-date now '%Y-%m-%d'}}

## Navigation
[Yesterday](/journal/daily/{{format-date (date "yesterday") '%Y/%Y-%m-%d'}}) <-> [Tomorrow](/journal/daily/{{format-date (date "tomorrow") '%Y/%Y-%m-%d'}}) 

## Tasks

## Notes

Now, for some configuration

I like to store my daily notes in a folder structure like journal/daily/2024/03-March/2024-03-17.md. It wasn’t clear to me, as I read the documentation, how to make use of a dynamic folder structure. Fortunately, if you format the filename with slashes zk does exactly what I want.

# ~/.config/zk/config.toml
[group.daily.note]
filename = "{{format-date now 'journal/daily/%Y/%m-%B/%Y-%m-%d'}}"
template = "daily.md"

Wire up an alias to make this easy

Now, you can create a daily not with the following command zk new --group daily. That’s cool, but kind of a lot to type. Back to config.toml and create an alias like so:

# ~/.config/zk/config.toml
[alias]
daily = "zk new --group daily"

Results… for now

Using Markdown Preview in Neovim shows a respectable start to a daily note.

daily note markdown preview

Now, from any directory, I can type zk daily and a well-formed, properly-named,file is generated as I like, where I like.

My next step is to set up Neovim to respect this configuration when I navigate to a daily note that doesn’t yet exist. However, this feels like enough for one post.