Initializing dssb

As a way to pad out my dusty resume a little bit, I've written my own static site builder, dssb. This site was generated using the tool. I'm still finishing up the build instructions and documentation for anyone curious enough to try it, but it is functional in its current state, so you can feel free to cram the release in your usr/bin/ folder and generate a site like this for yourself.

Static sites like this one have grown in popularity over the last few years, likely in part due to a certain Luke Smith's video on setting up a static site with Hugo. I figured I could make the same tool, fit to my own needs, by coding it in Python. Older iterations of this website have used Django, Flask, and even Hugo itself to sate my own curiosity about each library. I imagine this won't be the last time the site gets rebuilt.

dssb's source code uses a single application file containing a Builder object and a command-line interface built with argparse to access it. The Builder initializes a site by creating a new folder for it and copying over some default HTML files I made, called templates, as well as a CSS file for styling and two example markdown files, known as content. When building the site, the Builder collects all the content files and generates a new webpage for each one. Metadata in each content file specifies which template it should use, then fills it out. Here's an example of that metadata from this post itself:

title: "Initializing dssb"
template: "post.html"
tags: ["tech","dssb"]
publish_date: "2023-02-26"
# Initializing dssb
As a way to pad out my dusty resume a little bit...

In the above example, the metadata is at the top of the file, separated from the content with three dashes. The Builder loads the template file, then replaces fields like {{ tags }} and {{ publish_date }} with content from the metadata file. This behaviour and syntax was written to resemble that of the Jinja templating engine. Once all the metadata from each content file is collected, the Builder also creates an archive page for all the posts, a tags page for all the tags, and an archive for each tag.

A small upcoming goal is to release dssb as a standalone package in the Python package index so it can be easily installed via pip and receive updates from there. I doubt I'll be adding many extra features, but I'll probably rip off Hugo some more and generalize the site's behaviour a bit so I can automatically create pages for, say, all the movies I've watched recently and what I think of them.

I'm currently preoccupied with securing new employment as well as finishing up another project that I look forward to writing about soon: a social online drawing game that leverages Flask, jQuery, and HTMX (a new personal favourite JS library). I'll be writing about this game soon as a way to help me organize my thinking around its development: the project has grown complex and needs some compartmentalization before it gets out of hand. Shout out to whichever bored tech recruiters bothered to read all this: I promise something more substantial in at least a week.

Published: 2023-02-26
Tagged: tech, dssb