Tyler Griffiths

Shite, a shell site generator


I recently read Jeff Huang's This Page is Designed to Last, and took some time to consider how my blog is written: a handful of Git repos, a Yaml-controlled CI build, and automated deployment to a server. This works nicely, and was fun enough to write, but is most definitely a huge bitrot surface. I'm also not a huge fan of complex templates, and prefer web design to be as minimalistic as possible: a site that doesn't work properly in lynx and isn't readable as pure HTML doesn't quite understand the point of the Web.

This site is now generated using shite (shell-site), a simple shell script I wrote. If pure POSIX shell scripts become unrunnable, the Web has bigger problems than my site being unmaintainable! It does the following things:
  1. Traverse a directory tree, running every mkindex.sh it finds. This allows building listings of blog posts, for instance, but it could be arbitrary. In my case, one generates a index.part.html in my /posts/ directory.
  2. Concatenate together the first header.html it finds traversing up the tree, every $file.part.html, and the first footer.html it finds. The result is copied to the output directory.
  3. Copy the /static/ and /.well-known/ directories, as well as /robots.txt and /favicon.ico to the output directory
The basic structure looks like this:
|-- as213310
|   `-- index.part.html
|-- contact
|   `-- index.part.html
|-- favicon.ico
|-- footer.html
|-- header.html
|-- index.part.html
|-- posts
|   |-- computing.part.html
|   |-- mkindex.sh
|   |-- shite.part.html
|   `-- sourcehut-hugo-builds.part.html
`-- radio
    `-- index.part.html

Just call shite $inputdir $outputdir and the site is generated. Code is here, along with an example input site here.