In the world of knowledge management and digital note-taking, Obsidian is one of the premier tools. Its ability to create and navigate between linked notes makes it a favourite amongst researchers, writers, and knowledge workers in general.
One of the key features of Obsidian is its ability to create links between notes, similar to a wiki but for personal use. Fans say that this enables the creation of a “second brain” or a “digital garden” where your notes can interlink and grow organically over time. That is still a long way off for me but one feature of Obsidian that I have found particularly useful is the Daily Note – a fresh note created each day for capturing thoughts, tasks, and snippets of information.
Each daily note can link to the previous and next day, allowing me to effortlessly navigate through the chronicle of my thoughts. That, at least, is the theory…
In practice, however, this flow can break down when daily notes are missed or not created for certain days. This results in broken links, leading to non-existent daily notes when I try to navigate chronologically, linearly through my notes.
To combat this, I decided to create a Python script that retrospectively fixes these broken links, replacing invalid next/previous links with valid ones, even when some daily notes are missing. Here’s the process and the resulting code.
Understanding the Problem
The crux of the issue is Obsidian’s automatic linking of daily notes to the previous and next days, regardless of whether notes for those days exist. This is convenient when daily notes are consistent, but falls short when some are missing. It’s essential that the link updates are made to point to the actual previous and next notes, bypassing the gaps where no notes were taken.
Continue reading on Medium.