Should I make another static site generator?
The answer is probably no, but I still feel the yearning for it. Or maybe it's time to ditch the idea completely?
It's not a massive secret that I don't blog here much. Some part of it is the design - this isn't super readable for a blog, and I've never been able to style text posts in a way that I like.
Another part is just how complicated it is to make a post.
Introducing Jekyll
I use a static site generator, Jekyll, which isn't uncommon for nerds. How Jekyll works is fairly simple when it comes to blogs. All posts are Markdown files, stored under _posts. Each post has a "front matter" which sets properties on the post. For example, here is all of _posts/2020-05-05-blag.md:
---
layout: post
title: "Oh look, a blog"
date: 2020-05-05 19:54:00 +0200
---
Thought this would be better than the old single page with an image. Need some place for longer technical stuff, I suppose.
Go look at my Twitter instead. It's more exciting.
Immediately you may notice that making a post is a bit more complicated than just making a file and going to town in Notepad. Bare minimum, your file needs that front matter, with the "post" layout and the title. That's in fact how drafts look like - as I'm writing this post, the front matter is:
---
layout: post
title: "Should I make another static site generator?"
---
Drafts are stored in _drafts and are only accessible locally, when running Jekyll's internal web server.
Now, you may have noticed that this means there's extra work when publishing an article too. You need to move and rename the file to include the date, and add the date to the front matter. Painful.
I used to do all this manually, but eventually I wrote a shell script, tool.sh, which does this for me. Now I get to make posts with a simple ./tool.sh newpost "Should I make another static site generator?" and publish them with a simple ./tool.sh publish "Should I make another static site generator?". After that all I need to do is a git commit and a git push, and the GitLab pipeline will deploy it to my site.
At this point, I hope anyone who is using something more modern, like Blogger circa 2004, are screaming and pulling their hair out over this workflow.
To reiterate, to write a post I have to:
- Start my computer.
- Open Visual Studio Code.
- Run a shell script to create a post.
- Write the actual post.
- Run the shell script again to publish the post.
- Commit the published post.
- Push it to the repository where GitLab will start a worker to build it into a website, and put it on my server.
Can you guess why I'm not making any posts? After all, the best ideas come when you're half asleep, or on the shitter. I'm not bringing a computer with me on the shitter.
Do I need Jekyll?
Jekyll gives you a decent blog out of the box, with the Minima theme. Embed tags, site map, RSS, you got it. You may not believe it, I'm still using Minima under the hood on this site, there's just a lot of overridden templates.
However, over the years, I've ripped out more and more of the Jekyll plugins, and replaced them with templates.
The sitemap plugin didn't account for changes to templates, but rather just the post itself, so tool.sh now pulls dates from the git history, puts it in a YAML file, and lets Jekyll handle filling in a sitemap.xml template.
The "SEO" plugin generated lackluster embeds and metadata for the artwork section, so it was removed as well, and replaced with roughly 100 lines of template spaghetti.
At this point Jekyll doesn't really bring much to the table, beyond being something that applies templates. In a way, this is the strength of Jekyll - it's very flexible, and could be used for all kinds of sites. It's how I can generate an artwork gallery.
So, no, I don't really need Jekyll. Anything that can do templating and Markdown will work.
Do I need it to be static in the first place?
This is a more complicated question. The nice thing is that it's very "fire and forget" once built. It's much harder to compromise a pile of files on a dumb web server, compared to something with a login system and fully featured dashboard.
However, you'll never get over everything having to have a separate "build and deploy" step when you're not serving directly from the source. That means you can never realistically use an app for writing posts, because it's unlikely you'll find a git server that supports MetaWeblog which is an extension of the Ancient Blogger API.
The downside to leaving the static site generation world is that I'll need to move the blog to a different subdomain. My site stays usable down to IE6 without any JavaScript - I doubt that any modern fully featured blogging solution will do that, if it even lets me do things like an artwork gallery.
Final thoughts
Maybe the way forward is to have a separate blog, and just modify the main site by hand. Or maybe implement MetaWeblog as a daemon that can handle all the committing, renaming, and pushing for me. Regardless, if I want post more often, I probably need to change something.
I actually wrote a very basic and kinda bad static site generator back in 2013. Maybe I should revive it? :D
Also, as a funny aside, I would've probably changed the name of this post if it wasn't painful to do so.
