Picture this: you want to have your own website, some place on the Internet just for you and your thoughts. So now you have three options:
- Use a static site generator like MkDocs or Hugo, which is very appealing.
- Use a bloated, LAMP based platform like WordPress, which is even more appealing.
- Walk the righteous path and simply edit the HTML by hand, which is frankly repulsing.
Eventually, though, I decided to forfeit my software purism and use a static site generator. You know, a thing that takes some markdown files and lumps them together, adding css and js along the way.
Alas, no static site generator was quite right for me. I needed something simple, and something I would have full control of. So I did the only reasonable thing, and wrote my own.
Templates are easy
There is an old saying that programmers don't do thing because they are easy, but because they thought they were easy. The solution to my website problem turned out to be quite the opposite - as it turns out, templates really are just that easy.
The whole project took less than two days to complete, totaling maybe 6 hours of work. Most of which I spent on the website's design, tweaking CSS to make it minimalist and good looking (Did I succeed? You tell me). The only pieces of js on this site are: KaTeX, which renders math, and highlight.js for code block syntax highlighting. Useful if you want fancy equations and colorful code on your website, and I do.
It has also made it clear to me why people like python so much. It allows you to hack together a solution to a problem that does not require neither speed nor excessive control over details like memory management. You can have a website generator up and running with two imports (python-markdown and Jinja2) and a total of ~70 lines of code.
This is the kind of scenario where python shines - short development time and a wide array of ready-to-go solutions to high level problems like this one.
As a side note, my girlfriend is not a fan of the new style. Quote:
The website looks like it's broken.
Like there's been an error, or something.
Not everyone likes the minimalist style, or doing everything by yourself, and that's ok. But I do.
Update - March 2022
The website has underwent some significant changes since this was first written, and the generation script has grown to about ~250 LOC and uses some cool Bootstrap icons. It also now generates a full-blown RSS feed.
Is it all useless bloat? You be the judge.