nestbuilder
published: 2025-09-27 23:27:37
Sometime last year I once again found myself thinking of my site. There’s the odd thing I’ve thought of writing then never did, I’m not going to force myself to write, whatever I write, I write. This isn’t a post about how rarely I use my site but just general mulling over how I use it, and a little of the actual HTML.
I’ve made four or five site generators since starting this site. I’ve now upped that to five or six, about half the number of actual posts ;D Regardless of what they were underneath, they all ultimately took the form of markdown files with YAML metadata at the top, because that’s what every generator does. Here’s the thing though, I don’t like YAML and I also have a somewhat irrational hatred for seeing metadata at the top of my markdown files. It just feels wrong, silly or not.
Going through my RSS one day, I was reading a post1 where the author talked about redesigning their own site, one major revision being that every page lived in it’s own directory as an index.html
which meant that you could have .html
-less URLs without fucking around with web server URL rewriting but also, you could put any files referenced in the page within the same directory so you don’t have an assets
directory or similar at the root full of files that could be referenced anywhere. While that’s mostly just a grep
away, it’s still messy and inconvenient in comparison since the vast majority of the time you don’t really use the images or whatever else outside of a single page. It’s a simple thing and not one that I’d thought of before but after reading it I sometimes look out for other people taking the same approach and I’ve noticed it a few times, though some people seem to just use it as a way to have URLs without a suffix and still continue using a root directory for assets.
Metadata
I spent a while going over options, at first I thought I’d have either a single file or an SQLite database to contain all the metadata. A single file would get unwieldy fast so I was definitely leaning towards the database. Database vs files is one of those questions that doesn’t really have a definitive answer but after discussing the topic, unrelated to my own site, with some friends (even though I think things like generating index and tag pages or adding additional fields would be easier with a database) I decided to go with using files, for fun.
As mentioned at the beginning: I don’t like YAML or frontmatter. My solution, since I didn’t need or want any kind of typing in the file itself, was to just keep the metadata in a separate file using a conf/INI style format. This once again works well given that each page is a directory~
Output
One other small thing I dislike: Having a data
/content
directory for your markdown and an output
directory for the HTML. Now they all live together! Each page directory contains the following:
- index.md
- index.html
- index.gmi
- metadata.properties
- relevant files
All available by changing the URL. This makes scraping the site easier, which given the current AI climate, a lot of people probably don’t want. However, while I have a great distaste for AI, I think having access to the raw markdown easily has totally legitimate uses for regular people, like simply being able to read it easier, saving it for their own personal archive or whatever other reasons a real human might have for eucking about. It also ultimately makes rsync
ing the entire thing to the server less hassle *shrug*
As I moved my old posts to my new system I also moved several little scripts that were no longer available on my old git repos directly into the page’s directory, now they can’t be lost again :D
Tcl
I ended up writing nestbuilder in Tcl which I came across a little over two years ago while I was reading through some SQLite and fossil2 docs where they mention it being used in test writing, though more interestingly, SQLite actually started out as a Tcl extension!3 Fossil also has several settings where it specifies providing a Tcl style list. The more I read about it, the more intrigued I got. It’s very shell-like. Variables are “just strings”, the function calling them treats them as lists, array or dictionaries as it’s expecting them, though this does get a little odd with things like nested lists, and especially arrays. Functions (Tcl calls them procedures) look like shell commands, in part, due to them taking modifier switches.
I did want to use several other tools in building this, mainly yq
for the metadata and config files, and lowdown
for HTML and gemtext generation. I went with lowdown
over the usual pandoc
simply because it supports gemtext output which would let me use one program for both. Tcl let’s you relatively easily use external command with the exec
function, though you can end up in mess of escaping characters with complex commands, it worked for my needs after some playing around.
Tcl is certainly a little quirky. I was having an issue with the dict
command, if I recall correctly, and found an IRC channel linked on the wiki. It’s been forever since I properly used IRC but I hopped on and found a friendly community who helped me out :3 One of the aforementioned quirks I came across was some commands taking a variable directly, while others just taking the variable name, which is different and something I overlooked in the docs - careful reading required. There were some other questions I was helped with too, friendly bunch!
Speaking of the wiki4, it’s so quaint. Many of the pages read like conversations where people prepending their edits with their name, it feels very organically grown. Many pages are just tips for specific things people were trying to do at some point or pages of people trying to work things out. It’s all just lovely~
HTML
I’m not super into HTML or (especially) CSS, which it feels like I’m forever fighting with. I put together a basic template HTML and CSS combination a while back that I usually just copy and tweak when I want to make HTML pages. I decided to tidy it up a bit because I was sure there definitely redundant CSS in there. The old one used CSS grid
but I’ve changed over to flex
and reduced down the stylesheet a bit. I’m sure I tried used flex
before and didn’t have much luck getting it to do what I wanted but it worked out this time, CSS fun :|
Something I’m used to with most markdown processor templating is being able to include other templates, usually a header and footer, inside templates. Lowdown lacks that feature but I resolved the problem by just appending them together and it’s such an simple thing to do it’s not overly needed in the templating system itself.
It still mostly looks the same and I do keep contemplating changing it up more, but it will do for now.
Not Quite Done
While I’m now running my new site it’s not done as there’s some things the old one did that I haven’t even started yet, like generating tag pages and new things I’d like to add too. I intended to have gemini output as well but I haven’t quite worked out how I want it to look so that’s on the back burner for a bit.
As of time of writing I haven’t even added a readme to the repo, but you can have a look here5. I wrote a little fzf
wrapper script to let me quickly add/delete/update posts which I’ll probably add there in the future too once I settle on exactly how I want it to work.
It’s usable enough for now and I’m going to keep pecking away at it, despite it taking me a while I’m having a lot of fun with it~ :D