Daily Note automation with Templater + python

I’ve been using Obsidian for several months and have settled into a reasonably good workflow for notes, sources, etc. The Daily Note plugin in particular has been great for keeping track of what’s going on and doing quick capture that I know I won’t lose track of later, but there were two lingering things I didn’t like:

  • Having to go back to the file tree to navigate to previous days’ notes.
  • Having to manually move uncompleted Todo items from one day’s note to the next.

I’ve seen some examples of using text expansion scripts to create navigation links for Daily Notes, but this seemed a bit clunky to me, especially when trying to account for the logic when Daily Notes aren’t actually created every single day. Similarly, there are a few plugins that are supposed to support Todo migrations, but I’ve not gotten any of them to work so far.

Then recently I saw a YouTube video from Bryan Jenks about the Templater plugin, and when he showed macro expansions invoking arbitrary scripts I was pretty sure this was a workable solution. I’ve spent a few hours banging on some Python and have a couple of scripts that, when hooked into Templater macros embedded in my Daily Note template, do a few things:

  • Create forward and backwards navigation links in the Daily Notes that are correct even if you don’t, for example, create a note over the weekend or on a day off.
  • Migrate uncompleted Todo items from the previous day’s Note into the new Daily Note.
  • Append a tick mark to the end of each Todo item each time it carries over to a new day to help identify items that are lingering too long and might need some attention to get off the list.

I am in no way a skilled or probably even competent coder, but figured it wouldn’t hurt to share what I came up with in case it’s helpful to anyone else. Obviously most of the credit goes to Templater’s author for making such a powerful addition to an already great tool. At any rate, the scripts and some basic instructions are available here:

Enjoy, and please let me know if you have ideas for improving on this concept!

EDIT (14 May): This broke with release 1.1.0 of Templater, but I have recently updated the scripts to work with the new syntax and fixed a race condition with the file modifications that was causing issues in some cases.

4 Likes

Nice. I have recently used the same idea to create a schedule depending on the weekday in my daily note template after @osgav pointed me to the Templater plugin.

1 Like

Jason! This looks ideal to me, but I’ve no idea how to actually implement it. I muddle through obsidian as best I can but am committed to getting better. I do have templater, so would I just copy the obs_todo_migr.py as a note and put it in that folder? Sorry for my ignorance, but if you could give me any help I’d really appreciate it. Thank you so much!