Tuesday | 21 MAY 2024
[ previous ]
[ next ]

Building My Blog with UniVerse

Title:
Date: 2023-05-06

I'm not a fan of the navel gazing that is writing about blog generator but here I am writing such a post.

I write my blog bosts in a bastardized form of markdown, gemtext and yaml. I have yaml for the front matter which lets me build and set up some variables that I might use later. Currently I have Title, Date, Sequence and Tags. The Sequence is something I added to add some uniqueness to my posts, rss was having a fit when I tried to have multiple posts on the same day. It was likely a function of not understanding what the rss builder was doing and I solved it by this.

You will notice that as of writing this post, I don't have an rss feed so the Sequence is currently pointless.

I write my blog posts using my own editor, in my own shell, inside UniVerse. I would build a database if I could and then build the operating system as well if I got that deep. There is something so lovely about using things that you built. It's honestly a drug at this point.

I still have some issues in my editor to iron out but I've been using it for almost a year now and haven't had any major issues.

I used to parse markdown but I switched to parsing gemtext because of the simpler rules and I was already keeping my blog posts simple. Switching to gemtext meant that I could basically parse things line by line and usually by checking the first few characters. Code blocks are simple to process and so are quote blocks.I also added a bit of YAML parsing but not really. It's really a form of parsing where I just split on the ':' and keep track of what's in between the '---' at the top of a page. This way I can use the title and date as variables if I need to.

I then wrote a function that will build html files out of my blog posts. I have the html embedded directly in the BASIC program using internal subroutines and this is working fantastically. A future goal will be to add a render subroutine that can embed BASIC directly into a html template and then I can render templates on demand.

My program to build my blog also writes the hashes of a file to multivalue file. This lets me keep track of the hash, title, date and link. In the program I read in a blog post and check the hash before calling my parse routine. This sped up my blog generation from 6 seconds to fractions of a second. A significant speedup that is extremely worth it.

I can reset the cache by simple deleting all the records in the multivalue file.

I currently shell out to do an rsync where I sync my generated html files with my webserver. I also shell out to call git and backup my blog posts. I push these to github. This is actually the longest part now and a piece that I want to simplify and speed up. I want the process of generating and deploying my changes to be instant. There's no reason why that can't be the default.

I also have some rules for links, I want to make sure my links will be permanently working. I don't want to lose my links and so I formalized my rules for links below:

and with that, that is how I build my blog. Mostly in BASIC which I'm quite happy about. I'm sure I'll continually change it because it is quite fun to change things around especially when I know exactly what it needs to do. I can play with everything else besides the content which is nice.