About this site
This is where I put some personal opinions and projects. I created this site because I love the old web full of personal expression and quirky design.
The tech stack
Earlier versions of this site were created using Org mode. Although I find Org to be vastly more ergonomic than Markdown, I switched to Hakyll+Pandoc for the following reasons:
- Editor independence: Org mode locks me into Emacs (which is what I use for pretty much anything anyway) but I would like to avoid high friction if I decide to switch to a different editor.
- Less brittle: I found myself hacking with how Org behaves more times than I wanted to. Dealing with changes in the default stylesheet and getting the
I created the template by modifying the default Hakyll template, and created a small CSS file that I am growing slowly. There were a few deliberate criteria I have when creating the final template:
- Minimal design: I use default web fonts and a bit of CSS for having the text not run off the page.
- Almost no JavaScript: there are no trackers, and the only JavaScript is reserved for rendering LaTeX and demos.
- Small footprint: The two items above help a lot. I also use Hakyll to process all assets to optimize their sizes, and I use GZip compression for all HTML/CSS/JS files.
For math content, I use Pandoc’s MathJax export. To keep with the criteria above, I include the MathJax library only if the path has math in it. I detect this like so in Hakyll:
baseCtx :: Context String
baseCtx =
boolField "hasMath" hasMath `mappend`
defaultContext
where
hasMath item = "<span class=\"math" `isInfixOf` itemBody itemTechnically, this is pretty hacky: it would not have any false positives but it
could technically have false negatives if the MathJax output of Pandoc changes
(e.g. emitting class="inline math" rather than class="math inline").
And, I use the following in the templates:
$if(hasMath)$
<script id="MathJax-script" async src="..."></script>
$endif$To build the website, I have a publishing script that looks like:
#!/usr/bin/env zsh
REMOTE_DIR=deliberately hidden
SITE_DIR=_site
set -euo pipefail
stack run site clean
stack run site build
./compress-files.sh
cd $SITE_DIR
rsync -e ssh -avz . $REMOTE_DIRAll compress-files.sh does is running gzip:
#!/usr/bin/env zsh
set -eu -o pipefail
SITE_DIR=_site/
for extension in html css
do
find $SITE_DIR -type f -name '*.'"$extension" | xargs gzip --keep --best --force
doneHosting
Since October 2020, I use NearlyFreeSpeech.NET for all my hosting needs. I generally appreciate their “no nonsense” approach as a hosting provider: I am appreciative of their stance on their customers’ freedom of speech and privacy.
Before then, I hosted the site via Amazon S3 + Route 53 but I did not like the overall complexity of Amazon, and I wanted to move to a hosting provider that aligns better with my values.
