Obsidian Annual Calendar

Posted on May 19, 2024

Automating Obsidian Structures - an Annual Calendar

I’ve been using Obsidian for since 2021 - more on what for and why in other posts to come - and one great aspect is that its easy to extend yourself. This post is a quick look at one way I’ve done that. Whilst its not probably reusable unchanged by many, the structure and ideas may help. I use this on my Mac; the ideas and even the script basics will transfer easily enough to other systems where you can run scripts.

Daily Saved Articles

I have a means to save some articles I read - web pages or PDF - straight into my vault, clearly marking them with some metadata such as their source. to include these in my notes, I do it manually later. However, I have a sweeper script that runs to append a markdown link to each such article into a daily file for these things. I keep them separate from my Daily Note for safety - I don’t want a script changing a note I may also be editing. So alongside my daily notes I accumulate similarly daily article notes listing things saved that day.

Incorporation

I keep these generated notes separate from my hand written content, but the structured naming I use makes it easy to link either to individual articles or to that days article index file. On top of this, and on top of the various search mechanisms in Obsidian, I also wanted an overall index into my articles. So I wrote a simple shell script that can scan the folder I keep those generated article lists in to produce a formatted annual calendar, with links to all the days where a file was produced. I don’t generate an article index file if I didn’t save any articles that day. This is the script I include here.

End Result

Just to show what it produces, two screenshots from Obsidian.

  • one showing the markdown in edit mode. As usual withtables, it looks untidy but is very structured
  • and the end result in read mode.

markdown view

read only view

Script

This is a very straightforward shell script I run occasionally to generate the latest file I use. There’s a few hard wired local variables in it that are easy to adjust to whatever system you have.

Some basics:

  • it assumes all of the files you wish to index are in one directory
  • the name format for these is taken to be ‘YYYY-MM-DD_articles.md’
  • the output file is a markdown file in your local directory called ‘YYYY_annual_index.md’

So to personalise the script you’d need to just these items to fit your usage.

The script (hosted on gist so its easy to copy) is

Feel free to copy, adjust, and use.

Its not terribly sophisticated (no leap year handling for day 366 for example) but thats easy to fix as needed.

Dependency
The script relies on ‘gdate’, part of the GNU CoreUtils package. That can be installed via Homebrew.

Automation

I’m a huge fan of Obsidian, with a vault now into thousands of notes. Its open on my laptop even more than a browser is. I see automation like this on the side of Obsidian not as a failing but as a strength. No tool, no app, can hope to provide all of the scaffolding and tools we need to store the immense variety of notes. So the fact I can easily script on a Mac something to produce straightforward markdown files that Obsidian just uses like any other is very much what I want and expect. More of this in the future.