selja@hepta

about · now | months · tags · series | feed

further development on the blog software

we've got tags now!

as the summary says: we've got tags now. and tag pages! this required a bit of thinking - but i'd been clever and already put tags in the post metadata, so it was there ready to be exposed.

some details about the software

so, i make the software that generates this blog myself. it consists primarily of a honestly relatively short python script that hardcodes a lot of the details of things like generating posts, generating the index page, generating an atom feed and, most recently, generating tag pages.

the actual posts start as markdown, as understood by a python markdown library, and then after being rendered get squeezed into some jinja2 templates i've made by hand. those templates exist for every kind of page i need to generate, and there's some that contain macros, and whatnot. very standard, probably.

there's also a bit of metadata in each - in a home-cooked format, naturally. post uuid, title, author, summary etc (the uuid might sound curious - it's really just that the atom feed needs an actual unique id for each post and it's easiest to guarantee that by just attaching an arbitrary randomly generated uuid to each post). that metadata also gets ingested by the python script, and is used to generate all sorts of variables for the templates to render. i think technically i can even have a custom template per-post? so if you ever see exactly one post here that looks wildly different then that would presumably be why

finally, there's a configuration file for "globals", namely, what the domain for the blog is, what the different templates used for each kind of generated page are called, and whatever i think of that ends up being a global variable one way or another and that i'd prefer to not hardcode in the python script. this lets me potentially migrate the blog to another host just by changing the domain configuration and rebuilding the blog.

it's all very hacky - but it's also all static, and all run on my own computer - i just push the results of the static website build onto the server. this is very convenient because it allows me to host this whereever, potentially. it's also very inconvenient, becuase i need to find a computer that can run the scripts whenever i want to write a post. (galaxy brain move: spinning up a vps just to write a blog post)

about the tags

the tags are split on whitespace with str.split, then re-joined with underscores, lower-cased (if it happens to be meaningful) and formalised to unicode normal form KC, which first applies the compatibility decomposition (replaces "compatibility characters" that are identical to other codepoints with the canonical codepoint) followed by the canonical composition (composes all decomposed characters to pre-composed form where possible). that way i end up having a canonical form for each tag and as long as they're spelled identically from a human point of view, they should also end up being the identical tag even if one of them technically has a decomposed character somewhere in the original metadata

however... the actual name of the tag as shown on the post is based on the name as entered in the post metadata, so if i really want to show a tag as having some wacky capitalisation, i can just do that too. it'll still show up on the tag page for the same tag as that tag without the weird capitalisation.

final thoughts

i really just can't do things like "write a blog" without reinventing the wheel - my previous blog also featured a custom static site generation software, and that one was written in bash...

i'm still thinking of adding other stuff here. there probably should be a top bar for navigating to various pages; perhaps there should be an "about" page; perhaps there should be a tag index. pagination, posts by month, etc are also on my todo list.

and some way to contact me! i'm working on it. there probably won't be comments here, because not a lot of people end up in your blog comments anyway these days, and avoiding spam is difficult. might just put in a contact email as i've mentioned before, and if i'm feeling really spicy i might do something like low-tech magazine and make a system for converting emails to comments! manually, naturally. that could be fun, which is one of the main reasons i tinker with this thing anyway

edit 2023-08-13

due to popular request, the atom feed also has tags in it now

edit 2023-08-17

there's now also a tag index, and a top bar to put it in! (and an about page but there's not much there yet)