My static site generator

2022-10-31

This year so far, I have been trying to get my hands in a lot of stuff. I set up this blog with the attempt to say something about anything that could be related to this.

I wrote this static site generator a few months ago. It has been sitting on the shelf for awhile. I have picked it up to add a feature here and there, but haven't done too much.

What annoyed me though with the likes of some of the bigger site generators (i.e. Hugo) is that they are not solving problems that I have. Also, for what I want, I felt like I can just write something than having to fight the documentation.

To me, site generators are a mashup of existing tools - a markdown parser, a template engine, a configuration parser. It's pretty easy to get what I want out of it without having to do something too dramatic. If I wanted to do more stuff, it's just a challenge to do some more work.

The end result, at least for now is a site/blog generator that: makes some attempt at sorting posts by date, organize posts based on tags and generate an index for it, make builds of templates, control publication, etc. It's not perfect and very opinionated, but for something around 150 lines of Python in the end, it's pretty nice.

The link for it is on the bottom of every page here. It's not spectacular in any way and am not expecting anyone to use it, but it's out there.

I decided to write a post about it here months after I wrote it only because I have been interested lately in building up knowledge in new features in Python, as I am ending up working in it a bit more. I am working on a project to pull in and make as many goodies as possible to make it easier to work with my company's HTTP API interface. As I look back on my other stuff, it made me think of things I can take into consideration of the things I can probably do with this (besides actually using it more!)

Also, I operate this server using a single VPS instance in Hetzner Cloud. That server itself is heavily locked down SSH-wise because these servers become a magnet for hackers trying to drop in their random programs. I run Nginx to serve out the files.

Current feature set

  1. Uses mako for templates, markdown for posts
  2. Orders posts by date
  3. Allows for drafting posts
  4. Allows me to create tag sections and generate tag index pages.

Problems and thoughts on features

  1. The page renderer is a little backwards. I was trying to be clever, but if I care enough, I will rewrite it to be like Jekyll.
  2. My site design here is ... lacking. :)
  3. I want to expand it further for other types of sites and maybe add an auto-publisher with a mini-"CMS". For now, doing manual deploys is fine.
  4. There is no pagination, but I will worry about that problem when I get to too many posts. :)
  5. I want to implement a per-month index also, but I am not there quite yet in the number of useful posts.

In: blog