Ultra-minimalist website generator

When building gstelluto.com, I wanted a minimalist page. The idea of using a bloated static site generator for an ultra-minimalist page horrified me.

There are many minimalist static generators out there. I even wrote one myself a couple years back: crispy-static-blog (more of a hack than a project). Most of them, including crispy, are written in some language that glues the components together.

I want to generate a website using the simplest shell tools I can. Ideally, I want to have some HTML templating, a CSS preprocessor, and to be able to write my posts in some other markup than HTML. And whatever glues all of this together should not be written in an interpreted language like python.

The stack I ended up using is:

The alternatives

The major static site generators are, to date, Jekyll and Hugo. I’ve only had experience with Jekyll in the past, and while I found that it is a great piece of software, it’s still far from being minimalist.

The project structure

This is the structure we eventually want to achieve for our project.

.
├── articles
│   └── 2019-01-10-ultraminimalistic-
├── config.yaml
├── Makefile
├── out
│   ├── index.html
│   ├── res -> ../res/
│   └── style.css
├── res
│   └── pubkey.gpg
└── src
    ├── index.mustache
    ├── partials
    │   └── index
    │       └── hosted.mustache
    └── style.css
    

Anything else will work equally well. One just needs to modify the relevant lines in the Makefile and in the various mustache files linking each other.

Additionally, the out/ directory will be published to a directory on my webserver and served by nginx. This other directory is gstelluto.com:/var/www/gstelluto.com, as accessed by rsync.

Mustache

This wonderfully minimalist piece of software has two comprehensive manpages at mustache(1) and mustache(5).

We’ll make use of all of its syntax in this article, so it’s a good idea to read it.

A first

Publishing

We want to automate publishing the website and serving it online. This is really simple! Just add another phony target to the Makefile:

publish: all
    rsync -rL out/ gstelluto.com:/var/www/gstelluto.com
    

The rsync flags are -r for recursive, because out is a directory, and -L to tell it to (also recursively) copy all the files and directories symlinked — in this case, res.