December 16, 2019 ex machina

A description of how this site is built.
tl;dr: Cryogen + + gh pages
Tags: meta
  1. Static site generator
  2. Automating deployments:

A couple days back, I had the itch of getting a personal website. Mainly to stop maintaining a CV in Latex and have an easy reference to it.

There were a couple requirements I had in mind, both from the toolset and maintainability perspectives.

The site needed to be/have:

  • Statically generated. We just need to download some HTML
  • Markdown editing. Because I write MD all day
  • Written in Clojure. Relevant to the next point
  • Tweakable

The maintainability aspect had a simple goal: I don't want to fiddle with deployments. If my house catches fire I want to still be able to write about it. At the same time, i don't want to maintain both the source and the generated website. Ideally, my workflow consists of:

  • Setup. ONCE. Never come back here.
  • Write something and verify nothing breaks on localhost
  • Commit and Push the source
  • ??
  • Profit

Static site generator

I soon figured Cryogen was an ideal candidate meeting all the requirements. Besides setting up a custom markdown command to get tables compile the same way org-mode writes them, the experience was pretty much out-of-the-box.

I took some time after getting the first version of the post out to get rid of a couple things. These have nothing to do with Cryogen itself but with its theme template.

  • Goodbye Google (fonts). Not a fan of tracking. Helvetica is a nice default
  • The only script running is highlightjs in order to spice up code blocks
  • All assets were downloaded and are served by the site

These changes prevent the browser from reaching out elsewhere when loading the page.

Automating deployments:

The generated page is hosted on Github thanks to pages using a custom domain. The solution is free[TM] and too simple to resist. The site's source is instead hosted on Sourcehut and uses its Builds deployment platform.

The build script pulls both projects, builds the sources, copy/pastes the resulting page, and pushes to Github.

image: archlinux
  - clojure
  - leiningen
  - pandoc
  - dd63135f-599a-40f2-aad1-2a4e1fbc5d2c
  - setup: |
      git config --global "Remy Rojas"
      git config --global ""
  - build: |
      cd blog
      lein run
  - update-github: |
      ssh-keyscan >> ~/.ssh/known_hosts
      git rm -rf .
      cp -r ../blog/public/* .
      git add *
      git commit -am "job $JOB_ID"
      git push

After registering an ssh key in github and letting use it through secrets, we can effectively forget about ever touching Github again. In 25 lines of yaml.

Note to self: would be interesting to slurp the actual .build.yml file into the content at compile time in case it becomes outdated.