I HAVE BUILT THIS BLOG TEN TIMES

<-BACK<-

Like all programmers, I am a legendary procrastinator. My worst urge to procrastinate comes when it's time to start committing a thought down to "paper" in essay form. My preferred method of procrastination is to modify my blog. Oftentimes, when I start pulling a thread, I am overcome by the urge to completely rebuild the site from the ground up. I am honestly not sure how many times I've rebuilt this blog, it's at least 10 but probably much more. The messy commit history for the repo that saves this code extends back five years. Finally, I have what I consider to be the optimal website format for my needs. I'll detail some of those learnings here.

Framework

To date, I have used Jekyll, raw HTML/CSS/JS, Gin (Golang), Ruby on Rails, Astro, Next.js, React, Django, Fresh (Deno), Hugo, and Hexo (there are probably more but this is my recollection).

Here are the best three loadouts I've gone with in ascending order.

3. Jekyll

Jekyll is what this blog started on. Jekyll is a static site builder written in Ruby. I had to look up what language it's written in because it works well enough that you don't need to get under the hood to generate a completely usable blog. Jekyll is what I always suggest to people interested in getting into blogging because of its extremely well-documented integration with GitHub pages. All you have to worry about is writing markdown files, everything else is taken care of. Start with Jekyll, get a feel for what's missing, then migrate to something else. You'll already have markdown files which are the lingua franca between virtually all code-driven blogging platforms so there are no migration headaches. This blog existed for the first two years of its life on Jekyll.

2. Astro

I only had the blog on Astro for a few months. I put it as #2 because it's supposed to be the Next Big Thing for blogging. I think it could get there one day, it has all of the raw elements but it's unrefined and clunky in its current state. There are a ton of good innovations but at times the framework seems like a know-it-all trying to impose the "right way" of doing things on you. For example, there are .astro files with syntax similar to JSX but with some subtle changes, like kebab case for attributes instead of camel case. Fundamentally, I agree that this is a "better" pattern but since React has been so universally successful in establishing camel case params as the norm, it feels like friction in my brain. Astro has many such examples but I believe that as they build a larger dev community some of these rough edges will be rounded out and Astro will become the de facto standard for code-generated blogs.

1. Next.js

Full disclosure - I love Next.js. I have been using it almost since its inception and I see it as the spiritual successor to Ruby on Rails (sorry DHH).

Next fits all of my needs for this blog. Here are a few things Next gets me:

Static pages. Next has support for building an entire site to static assets which allows for deployment anywhere, even on GitHub Pages. I have used that functionality before for the entire site. Now I am using it in a more granular way. All of my essays are prebuilt so all the server has to do when you load the page is send the HTML. Other sections of the site are dynamic and don't use this approach, the tradeoff being slower speed for increased interactivity.

Advanced routing. I can easily create any number of complex routing schemes I want with Next in multiple ways. I have a few very popular essays that I've taken down - I want those URLs to redirect to specific pages instead of just returning a stock 404 so I can define whatever redirects I want in my next.config.js file. I can make these temp or perm and I can redirect based on regex. It's like having just enough Caddy without having to write my own server. Furthermore, inside of server-side rendered pages, I can add whatever other kind of redirect or URL weirdness I want to.

API. I can add API endpoints or server-only functionality by creating a route.ts file at the path I'd like to create an API endpoint for. One of the things I use this for is personal automation. This site is already deployed with CI/CD, if I have a hobby project I'm workshopping, I can just glom it onto this website until it's got enough legs to warrant the startup cost of breaking it out into its own application. I access most of these endpoints via my private and custom Discord bot so I don't even need to build my own frontend for code I'm hacking around on.

Deploy

Simple take here - I deploy with Vercel. It has the best integration with Next. It also has an analytics library that I can plug into my code. If I want to see if a deploy succeeded or how many eyeballs I got on the site today it's all under one roof. For my blog I don't think I'll ever hit the point where I'll have to pay a dime for hosting on Vercel. Pricing for the convenience is pretty steep though once you hit the free-tier limits so YMMV if you have an actually-well-read blog or webapp with a lot more function invocations than my personal API endpoints.

GitHub Pages is another option for deployment. If using Next you could just configure it to build static assets as output then host those with GHP. I've used this configuration before with Posthog for analytics and found it worked fine for a static site.

Strategy

Now is the best time to start your blog. Not because it will get a huge influx of readers or because blogging/long-form is about to be popular again (it's not) but because it helps you clarify your ideas. If you're a software engineer you'll probably learn some interesting things about hosting/servers/frontend that you might not have touched on before with commercial work. The writing is gratifying, the coding is gratifying, what's not to love?