, 3 min read
Lesser Known Static Site Generators
Original post is here eklausmeier.goip.de/blog/2021/03-07-lesser-known-static-site-generators.
Well known static site generators are Hugo (written in Go), Pelican (written in Python), Grav (written in PHP), or Eleventy (written in JavaScript). For a list of static site generators see Jamstack (322 generators listed) or Static Site Generators (460 generators listed).
The following three static site generators unfortunately are not all in the Jamstack overview.
- mkws: a minimalist static site generator, written in 31 lines of sh and 400 lines of C
- Saaze: an easy to use generator which is able to generate static or dynamic sites, written in PHP/Symfony
- Franklin: easy embedding of math and Julia notebooks, written in Julia, mentioned in Jamstack
To better understand what makes above list stand out against the more popular ones: Hugo's daily use is a little bit cumbersome and every release of Hugo gets more complex, additions to the Hugo source code are unwelcome.
1. mkws was covered in mkws - Static Site Generation With The Shell. The main loop in the 31 lines of shell code is:
for t in "$srcdir"/*.upphtml
do
echo "Making $(basename "${t%.upphtml}".html)"
pp "$sharedir"/l.upphtml "$t" "$1" > \
"$(basename "${t%.upphtml}".html)"
done
I.e., read files with suffix upphtml
and run them through the simple pre-processor program pp
. pp
is like php
, but way simpler, although not necessarily faster. pp
pumps everything between #!
lines through a shell.
Posts in mkws have to be written in HTML, unless you add another helper program to the equation. mkws is to be considered a proof-of-concept.
2. Saaze has been written by Gilbert Pellegrom, who also wrote PicoCMS. Directory layout of Saaze is as below:
saaze/
├── build/
├── cache/
├── content/
│ ├── pages/
│ | └── example-page.md
│ └── pages.yml
├── public/
│ └── index.php
└── templates/
├── collection.blade.php
├── entry.blade.php
├── error.blade.php
└── layout.blade.php
The "build" directory will contain all HTML files, if one generates entirely static pages with the command
php saaze build
The "public" directory is used, if instead, you want your pages fully dynamic, i.e., with possible PHP code embedded.
The "templates" directory is used for templates, which are based on Laravel Blade.
Posts in Saaze are written in Markdown, and each post is prepended with a short Yaml frontmatter header, e.g.,
---
title: An Example Post
date: "2020-10-13"
---
This is an **example** with some _markdown_ formatting.
Posts in Saaze are called "entries". These called "entries" are collected together in what Saaze calls "collection".
Saaze can be extended to match ones own Markdown tags. This is described in Extending Saaze.
3. Franklin is used for the entire Julia documentation and shines at mathematics. It was written by Thibaut Lienart. For example, the Julia website is generated by Franklin.
The directory structure of Franklin is:
.
├── _assets/
├── _layout/
├── _libs/
├── __site
│ ├── index.html
│ ├── folder
│ │ └── subpage
│ │ └── index.html
│ └── page
│ └── index.html
├── config.md
├── index.md
├── folder
│ └── subpage.md
└── page.md
The "__site" directory and its corresponding sub-folders are created by running
newsite("TestWebsite"; template="vela")
from within the Julia REPL. The "__site" directory is then to become the web-root of your web-presence.
From the three generators, Franklin is obviously the most powerful one. It has good integration to site-search using lunr.js, with math, with source code, even live Julia code, or plots.
Each post in Franklin is a plain Markdown file.
Added 02-Jul-2023: There is a "blogging" software in a single PHP file, called 1fileblog.php
, which does the following:
- Handle caching, i.e., if page was already converted to HTML, then don't do it again
- Run shell script
markdown.sh
on content, and then cache the result - Add header and footer
This PHP script is only 128 lines of code.