Site ExplainedPublished on Tue, 7 Nov 2023|Updated on Thu, 30 Nov 2023|2 minute read
Site Goals
Throughout the years, I've accumulated a ton of notes on my life, my work, and my interests. Having recently moved from Evernote to Obsidian, I began concentrating on markdown-focused note-taking. I also recognized, supported by a particular friend relentlessly advocating for my writing to become public, that it might be valuable to share some of these notes with the world.
To that end, it's been a pleasure to put together a small website, toying around with a means of getting these markdown notes onto the internet.
How the Site Works
Having used Cloudflare Tunnels for a Remote Control feature, I was already familiar with the Cloudflare API... and it just so happens that they're one of the best DNS providers, with security and performance. A sweet deal if there ever was one - since a free-tier account also comes with Workers and Pages, which provide a means to "Build & deploy serverless functions, sites, and full-stack applications."
DNS
Cloudflare provides a super easy interface to domains. Buying one was done in a matter of minutes, and certificates, billing, etc. is all easily configured (especially for auto-renewal!).
I found the affordability and no-frills aspect to Cloudflare's offering especially appealing, given that other providers have significant markup, and push their own security products, which one is almost guilted into, that bring significant up-charges.
Here's an example of what registration looks like for davidriott.com:
Cloudflare Pages
Cloudflare Pages offers a convenient way to integrate with a GitHub repository, run
CI/CD pipelines, and deploy a static site. This is provided free of charge via a free-tier, the limits of which I'm in no danger of exceeding currently.
With a simple build script, Cloudflare offers workers to run CI/CD pipelines for the Pages site, and you can be up-and-running in an hour, easily.
Cloudflare's dashboard displays a Page site's most recent build:
Cloudflare also provides an easy way to see traffic on the site, so you know what's going on. In a parallel universe, should this blog go viral, it would be possible to see what's going on. Check it out:
Custom Build Script
So what's the magic that transforms markdown into HTML?
Essentially, a simple Python script represents the entire site construction.
With a Python library called markdown (which itself is a Python implementation of John Gruber's Daring Fireball - thanks John!), the initial conversion of markdown to HTML is complete!
After the main markdown to HTML conversion, I perform a few extra steps:
- Ensure that Obsidian inter-note links are converted to the proper link for the right note on the site.
- Ensure that Obsidian image links are rendered correctly as anchor tags.
- Determine which pages to publish from an explicit list (so I can include drafts and other pages in the git repository that won't be rendered live).
- Render "Feature Pages" on the homepage that are snippets of their complete posts.
Since the GitHub repository is private, I am not currently sharing the entire build script, but it's so simple that it's not important.
Wrapping Up
What is important, is that with this setup, adding new posts and sharing thoughts, ideas, and challenges becomes trivial. All I need to do is write in markdown, and then choose which notes I want to share as posts on the site. Awesome!
Thanks for reading, and enjoy the posts! I'm reachable through LinkedIn - feel free to drop me a line.