While intended for a general audience, this is a vaguely-technical outline regarding how this blog site is and came to be. For the "why", look to this post.
A wise man once said: "my code may be garbage, but everyone else's is worse".
That man was me, repeatedly, over the week it took to make this work and trying out different options. I would avoid taking this as any sort of example of good practice. "It works" is not a synonym for "this is quality". I don't know if this is even informative. Nevertheless, I'll plough on, skimming gently over the multiple GitHub issues opened in that time.
In case you missed it in the footer of every page on this website, this whole thing is running on the Django framework as a base. Which is a funny way to say someone else wrote quite a lot of the code. Welcome to computers, truly we stand on the shoulders of average-height giants.
After hacking together the Halo Maps subsection of this site I had the sense to not try to also do this completely from scratch and looked around for anything I could install and use.
Initially I tried a pre-made blog package named Puput. I have cut out several paragraphs of complaints about Puput.
In short it was fine. It's fleshed out and functional, but it annoyed me in a couple of pedantic ways and several more very annoying ways that I'm sure will be fixed with time (I couldn't disable comments?! The version requirements are completely broken!?) such that I struggle to recommend right now.
So that went in the bin - but not before I realised it is essentially just some pre-designed pages and wrapping paper around something called Wagtail, a Content Management System (CMS) for Django, which is the actual heart of it.
And it's pretty good! the admin page approaches being actually usable, the documentation is workable and the selection of pre-made "models" (see glossary at end) are nice to use and there is a cool (if you're a nerd) system for packing these together into all sorts of custom structures/layouts that all works great in the admin background straight out of the box.
Because I already have a bunch of custom "stuff" that I cannot be bothered to port over right now, I have just glued this onto the side, but you can totally make a full website (or multiple!) using it. If you're already familiar with Django then this fits in nicely, writing your models and template will feel quite smooth.
There's also a load of packages that people have produced to extend Wagtail; Puput was one of them, but there are many smaller ones, such as nice code blocks or a KaTeX maths renderer:
In this way I feel I've got a lot more control over what's going on and it's not a total pain to change things up. I can use my existing templates for the layout and basic styling, so it's visually integrated into the rest of the site, able to add features as I wish, or tweak the styling specifics, etc.
oh right, styling. You probably also noticed the TailwindCSS mention in the footer as well. If you've never heard of it name might suggest it's got something to do with CSS. If that still means nothing to you, (besides wondering why you're even reading this) I'll to rephrase: if HTML is the instructions on what should appear (title, some text, a button), CSS is the instructions on how to appear (bold, blue-ish, has an outline with rounded corners and animates a bit when you put your mouse cursor over it).
Tailwind takes a very different approach to the whole Cascading Style Sheets ordeal, of which I am simply not capable of explaining better than they do, so I shan't try. The important part is, unsurprisingly, someone made a neat lil' Django addon to integrate it into the command line management tools, including a monitoring mode so it can detect styling changes almost immediately and I can actually see what I'm doing in more or less real-time.
As for the colour-scheme as a whole, it is Catppuccin. Specifically an official port for Tailwind. I've designed around the "Mocha" theme specifically, but if your device is set to light mode it'll be showing the "Latte" theme. Switching essentially just swaps the values of named colours out for different values with the same name, so I it's minimal effort to support both! Great feature.
A brief Django glossary
- "Models" are the primary code parts that you write for Django and are how you say, for example "this is what a user looks like", "this is what's inside a blog post", or "when a user visits this page and sends ABC, do XYZ and send back a result". In short, it abstracts away all the mess that usually comes with using databases, and like databases they can be connected together to join up bits of information - so my "BlogPost" model has a section (a "field") that says which "User" is the author. You can see my name at the top of this post thanks to this. It has another for the tags, the title, and for these very words.
- "Templates" are the outline of what the actual web pages will look like. Mostly just HTML, but with extra "tags" in a format which represent placeholders, or little bits of code that is understood by Django. These help to construct ("render") the final page before sending it to your eyeballs. It would be a massive pain to make a new HTML file for every single blog post, so instead I have just one,
blog_page.html
, which has the basic outline and says where the title, username, etc. should go. The exact details are slotted into place depending on which post you ask for.
How are you supposed to close out a blog?
Bye? Bye.