where we're going + a tour

Sunday, July 9 2023

Hey. This is a new place I've put together to talk about technical and, ideally, many more not-so-technical things.

This is far from my first attempt at blogging. I can't remember all the previous iterations, but they included:

  • a static site built with Hugo
  • a dynamic site built in Go
  • a static site built with Zola
  • and now this, a dynamic site built with Rust

My main issue with Zola is that it felt a bit inconvenient to set up something like the /now page, and instead I ended up building an entirely separate site for that on another domain1. I created shortform posts via text with Twilio, and the /now page has a similar setup with an API on this server + Siri shortcuts.

The Zola blog also used Tufte CSS as the base for the styling, whose margin notes, while looking very slick, required some ugly raw HTML in the markdown to support2.

Here's a bit of text hopefully with<label class="sidenote-number"></label> a sidenote.
<span class="sidenote">And this is the sidenote</span>

These margin notes also did not translate well into footnotes for the RSS feed.

Some high-level technical details

Because I got to write this blog from scratch, I got to add in a lot of the features I wanted, and none of the ones I didn't, bugs exempted. There's still a few things left to add, like proper tag support, RSS feeds, and a reviews page, but I'm about 90% of the way there.

This site is served by an Axum server, using Comrak for markdown parsing and Askama for templating. I originally used pulldown-cmark for markdown, but its footnotes support exists only on the master branch and not yet in the latest release, and I did not want to deal with figuring out how to use that in the build (I'm sure it's not hard to do). Askama is very slick, with familiar Jinja syntax, compile-time template checking, and a straightforward experience to create new filters. Everything about it worked the way I wanted it to without fuss, and that's about the highest praise I can give to any tool.

There's also a small CLI I use to create new posts and start the server, built, of course, with Clap.

In my content directory, each post gets its own markdown file and config TOML:

❯ lt
.
└── 20230709-hi
   ├── config.toml
   └── index.md

I have a general dislike of frontmatter because I feel like it pollutes the content and I can be an unnecessarily pedantic person when it comes to personal projects, hence the separate config. I originally wanted to use Nickel for the config language (mainly to play with it more than any functional reason) instead of TOML, but working with the toml & serde crates was a lot more straightforward than dealing with parsing Nickel. So it goes.

All the styling was written using vanilla CSS, which has gotten really...pleasant(?) to work with with the addition of CSS variables, flexbox, and now CSS grids. The last of those in particular has almost made frontend development fun again3, and while I didn't dive in deep enough to do things the "correct way", I never needed to reach for a CSS framework to get intuitive, responsive layouts. There is a notable lack of syntax highlighting at the moment, mostly because I use a custom color scheme which I haven't yet ported to Sublime Syntax spec for use in syntect.

Everything is deployed on fly.io, and I used nix + crane to setup my devshell and build docker images. That whole process was a little bit of an ordeal, and deserves its own dedicated post detailing what I went through to get everything working, but there were some emotional peaks (I can set up a shell environment on any machine so easily! and the generated docker images are so freakin small!) and troughs (trying to add a static resources folder to the docker output was...a test; also I cannot currently build the docker image on my Mac so I have to rsync the repo to a Linux Mint VM and build/deploy it there4 which is definitely not an ideal experience every time I want to make a change). Nix and rust are still relatively new to me, so working with both so deeply and at the same time led to a lot of learning.

The /now page is built mainly for quick tweet-like thoughts, which I usually like to send from my phone. The endpoint has a POST handler with basic auth, which, paired with a small Siri shortcut, lets me quickly create them from my phone without having to deal with Twilio's general shittiness.

There is one small feature that I haven't talked about, which are prose pages. I think I'll leave that for another time since I think its worth its own discussion.

I think that's all for now!

  1. I am letting this domain expire so this site could be down depending on when you read this. I haven't yet decided if I want to migrate all the old posts from there onto here. The source should live on though!

  2. Yes, these could have been turned into a custom shortcode. I think I did try that though, and I didn't like something about it...I don't exactly remember.

  3. There was definitely an audible gasp when I discovered grid-template-areas. It's so cool!!

  4. Apparently there's a way to do this using darwin.builder but...I did not want to deal with figuring this out. The VM solution is fine for now and I will probably stop using this Mac in the next few months anyway.