I recently migrated my blog to a new platform for the 1200th time. This time I moved to [Obsidian Publish](https://help.obsidian.md/Obsidian+Publish/Introduction+to+Obsidian+Publish). # Why - I want a low-friction way to publish notes. Since I already use Obsidian for note taking, this is the lowest friction option. - I want to outsource all technical aspects of getting a blog on the internet. - I want to create more content. Content creation and ideation are in a virtuous cycle. The more you create the more ideas you have of what to create. - so, the lower the friction the more content i can create. - I already have high and medium friction handled: - Youtube - High friction - Medium - Medium friction - Notes - Low friction - Thus i think that by reducing friction while also making my posts public i will create more. # Publishing Notes In the current iteration of the blog I'm writing more for myself than others. Previously I spent far too much effort getting posts ready for publication. I'm taking a new tact. Publishing notes on my thinking, learning, etc. No audience in mind other than my future self (hey you!). Even after all those words i'm not sure i'm expressing the idea clearly. For more polished works, I resumed publishing to Medium: https://medium.com/@ians. Those posts are in a sense the opposite of what i'm going for on this blog. They are meant for an audience, and ideally will get some traction on the internet. This blog on the other hand is my own corner of the internet which just happens to be publicly readable. Regardless, the idea was to publish notes and using my existing note taking software to do so seems like a great choice. It's relatively recent though, so we will see. # Working around limitations So, to the ostensible point of this post: How to customize Obsidian Publish to your needs. Here's what I wanted: - An index page that links to all my blog posts. It needs to be "dynamic", in that it updates as I add new posts. - All my posts published and technical SEO handled Not a long list of requirements. I explicitly don't care much about the styling. Also note that i didn't include search on that list. I consider it a nice to have. When i think about how I consume other peoples blog posts I never use search. I'm not writing this for others to read, BUT, i'd like to be exposed to that possibility. That's why everything is public. Obsidian Publish handles all the technical SEO and server stuff, thank goodness. However, they don't offer much in the way of dynamic content. They explicitly say you can't use things like the [dataview plugin](https://github.com/blacksmithgu/obsidian-dataview) which lets you make dynamic queries on your content and output the results on a page. Plugins like that require the Obsidian app to be running, and that's not how Obsidian Publish works. Oh well. ## Replacing dataview with... code I would prefer if the dataview plugin worked directly, but since it does not we must take matters into our own hands. I had to break out the code for this one, here's the gist: - Create a script to read a list of all your posts, sort them, and output the result as markdown into a specific file - Use that file as your index page for the blog - Re-run that script whenever you update your content Simple! It was actually quite quick to get this resolve because this is the type of problem AI can solve easily, and it did. I told it what i wanted and it wrote the script. Then I set up a macOS launch agent to run my script whenever contents in the directory changed. This has the added benefit of letting me update yaml metadata in the files under certain conditions. For example, the `date` property in the metadata gets set when a new file is created. The fact that the script runs whenever files change is very convenient. Here's the launch agent configuration if interested: ```xml <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Label</key> <string>update-blog-index.job</string> <key>ProgramArguments</key> <array> <string>/Users/ian/.bun/bin/bun</string> <string>run</string> <string>generate-index</string> </array> <key>RunAtLoad</key> <true/> <key>StandardErrorPath</key> <string>/tmp/update-blog-index.job.stderr</string> <key>StandardOutPath</key> <string>/tmp/update-blog-index.job.stdout</string> <key>WatchPaths</key> <array> <string>/Users/ian/kb/Personal/blog/posts/</string> </array> <key>WorkingDirectory</key> <string>/Users/ian/kb/Personal/blog/</string> </dict> </plist> ```