The first big update:
The new content system is up!!
This is a completely different system to the old SHTML-based one. For all the charm of SHTML, it's far too verbose for my continued use of it. The new system is written in PHP, and can accept multiple formats, as well as supporting theming. I'm not sure if/when I'm going to get around to making the code for this public, as it's kinda a rat's nest implementation-wise. You'd need to have identical Apache VHost conf for it to work because of how it handles the downloads page, among other things.
That all being said, I'll briefly document the rough design here, for anyone who wishes to copy me(please don't this thing is so janky).
Entrypoint
The entire system is served through handler.php, a script which manages the theming, formatting, and whatever else.
When it loads, it first initializes Parsedown, Mustache, and imports simplehtmldom. These libraries get used at various stages in the game later on. After that, it checks the cookies for theming and JavaScript opt-in data. These will be user settable down the line. Once it's located the theme the user has configured(or fallen back to a default), it loads
The Content
This is one of 3 things. For static pages, it supports Markdown and HTML, and in the case where I need to be more dynamic, it supports PHP.
Once the source file has been found(I let Apache handle the filename resolution for the most part), the system checks for a .nh file. NH for No-Handle. If the system finds one of these, it will stop everything, set the MIME type for the file, dump it over the wire, and exit. What happens next is up to the file extension, which can be one of
.html / .md
Markdown and HTML are handled almost identically. First, the aforementioned Mustache library is used to provide them with limited templating facilities. I don't register many handlers, as it stands, but this will likely change down the line. The crucial things here are the ability to query whether JavaScript and cookies are enabled. Not in the browser, mind you. One of the core things I want for this site is the ability for a user to opt-in to those things. This will end up leading to disabled links and pages, down the line, I'm sure. That's not a bad thing.
If it was a Markdown file, at this point Parsedown gets run over the resulting contents of the file, and the templating process is done.
Almost done, anyways. Because files only have page contents, and can't control the HTML <head>, I need an out-of-band way to set the title, and it would be nice to have a system for disabling theming per-page, without disabling the templating or markdown system altogether. This comes in the form of a simple directive system. It strips lines prefixed with $! and does stuff based on them. The following directives are supported:
$!title <title> - Uses the rest of the line as the page title.
$!notheme - Disables the theme completely, only outputting the result of the templating/markdown steps.
$!noextras - Disables headers/footers, while keeping around the theme's HTML scaffold.
PHP
PHP scripts are simply executed. The Output Buffering library is used to take the stdout of the PHP script. Early on, the script was expected to return the title, but with the addition of notheme and noextras, the script is now passed a set of functions with which it can set the 3 main properties.
Themes
Once that's all finished up, the theme gets run. Themes consist of the following files, which are processed in the following order:
/manifest.yml - Currently, this just stores if a theme requires JavaScript to function or not. If a user has their theme set to one that requires JavaScript, but has yet to opt-in, they will be given a fallback theme.
/preprocess.php - Allows the script to make modifications to the HTML content. In the current system this is primarily used to generate the ASCII-art <h1>; tags. This is the main source of jank.
/extra_ctx.php - This allows the theme to generate data to include in the markdown for the theme's template. The current theme uses it to generate the optionally disabled links in the header, although I'd like to move that to mustache later on.
/template.mustache - The actual mustache template! It gets given the extra context and the processed content, as well as the global helpers and some request metadata. The output of this will get sent back to the requester.
That's it!
That's the basic flow of the system, although I've left out some stuff. The downloads page is implemented by forcing all requests to a downloads.php file that does... a lot... of stuff! I delegate to mod_autoindex in there. Figure it out!
Fediring join pending!
My first(second) webring! Technically I'm in the Melonking Surf Club ring too, but I have yet to figure out how to incorporate it into the current design. I've sent in the Fediring join request, though, so that's fun. The buttons are on the hompage, awaiting activation, and when they're up, I'll be properly in! It's fun!
That's all from me!
College has been busy, and I have other things I should be working on than my website, but this has been clawing at my brain for days and I needed to get it all done. Be sure to email me with any issues!