TrickJarrett.com

Custom Paths

7/27/2022 8:49 pm |

Making tonight an early night after yesterday's (admittedly) productive insomnia. After work, went out to do a quick bit of errands with the wife, and after we got home and watched What We Do in the Shadows I got back into my code.

Mostly finished my taxonomy rewrite - There is still more to do, but we're back to parity with the previously (badly) written page and we've added the ability to define hierarchy in the tags. Though the backend doesn't yet do anything with that information. That's phase 2 of this bit of work.

Custom paths - Unlike Wordpress and most other blog engines, this CMS was conceived for links and Twitter-esque posts (the very first name of this blog engine was 'Blips' before I moved to 'Glowbug' as its name.) I've been expanding Glowbug's capabilities as I use it more, but due to this original design concept I didn't give posts their own pages by default.

Most of them exist only on the main index (while they're new) or on date archive pages. However, I did eventually add the functionality for standalone posts - but, again, I opted for maximum simplicity at first. Every post is given a unique hash string identifier (for example, this post's hash is 'fa340ae8'), and up to now that string has been used when generating the page urls. Simple.

Tonight I started the code to allow me to set custom paths. It's probably 60-75% of the way done. I can add them. And when I publish it sets the URLs correctly across the site. But the work, as always, remains on the admin side. Things like the paths still don't show up correctly in the admin panel, or needing to be able to edit paths once published, or when I have a post drafted but not published, that currently doesn't handle paths properly. But - we're getting there.

Delete ghost posts - As part of the above work, I uncovered an overlooked bug. The way the site published posts has, up to now, been entirely additive given that file paths were all fixed. No generated html files were being deleted. Again, this structure was perfectly find under the original design specs. But adding standalones is when this became a bug. Once a standalone post was published specifically.

Standalone posts could live on as ghost posts after I deleted them in the blog's database. Because, the way it was written, even if I deleted it from the database, it's generated html file would remain. I fixed this by adding code to remove any standalone files when a post is deleted. I still need to catch when a post path is changed after publish, and some other corner cases. But as we have a userbase of 1, I can be confident that that is not a major problem I'm going to run up against in the short term.

And that's it. I'm calling it quits for the night. Sending out the day's newsletter and heading to bed to read until I fall asleep and make up for some of last night's sleep debt.