Making a static site generator (because I hate myself)

(Disclaimer: embarassingly unfinished and WIP)

I thought a fun way to use neocities would be to make my own static site generator. After all, why use something that exists when you can make it yourself? I sure as hell have nothing better to do (unemployed btw)…

This is a living document. Hopefully as I update the build process, I will update this page to reflect it.

Flow

  1. Write page content in a Markdown file.
  2. Compile the Markdown to HTML using Pandoc with a custom template.

The template

Annoying note: Pandoc makes the distinction between html4 and html5 templates. This is a bit confusing, because invoking pandoc -D html will return the html5 template, but pandoc will not automatically use the html5 template for html output. (This might be an issue on my machine only (I use Gentoo btw)).

pandoc article.md --template=default.html5 article.html

If we compile our markdown file using the above command, we get proper output. Naturally, this will be a very bare-bones page. I want to put in some passable CSS so this site doesn’t look like your typical retro-zoomeristic site made by a /g/ lurker who drank waaaay too much of the Kool-aid. This can be facilitated by passing a URI using the --css flag. You could also use the -V css=<URI> to substitute the $css$ variable in the template, but the --css flag has the added benefit of disabling the default CSS included by Pandoc. I also include --no-highlight because Pandoc’s default syntax highlighting causes issues with most classless CSS frameworks I’ve tried.

pandoc article.md -o article.html --template=default.html5 --css=https://cdn.jsdelivr.net/npm/sakura.css/css/sakura-dark.css --no-highlight

Spellchecking

Could be facilitated using aspell (and a custom dictionary) run before pandoc. Hopefully aspell has some way to ignore the content in the code blocks…