Dream Nebula | [home] [contact] [blog]

2023-05-28

Using POSIX shell to build this website

Heyy, I’m now a real minimalist freetard!

For the past couple of months, I’ve been using Hugo as my go-to static site generator, and it’s pretty good! Super easy to use, you write posts in Markdown, you can easily host your website locally, and more. It’s great, but as time went on, I realized that in general, I used a very small subset of it’s features for my humble blogging endeavors; The most complicated thing I ever did with Hugo was making the website theme, which was pain only because their documentation is shit.

That made consider other simpler alternatives, but I ended up making my own SSG.

I actually had this project laying around for a while, but it was only recently that I got back to it and fixed and added some things. My main goals with it were:

  1. Simple and small, with only the bare minimum for my needs;
  2. Allows me to write the posts in Markdown;
  3. Have template files for easy customizability;
  4. Be able to generate a readable RSS feed*;

* I ended up making it generate an Atom feed instead. I'll explain why in a bit.

In summary, I don’t need variables, scripting, pipes, or whatever shiny things Hugo has that I never knew about. I just want a simple website, with a simple layout, simple hypertext stuff, and a tool that’s easily extensible.

The very first implementation used pandoc to convert the Markdown files to HTML files. Yes, I know it was a dumb idea, not because it wouldn’t work (it actually worked very smoothly), but because pandoc is a huge program; It’s package on Void Linux has an installed size of more than 160MB. I mean, it’s not even made for things like this, it’s focused on formatting actual documents and stuff. Anyway, eventually I switched from pandoc to lowdown, which is a much smaller program that converts only Markdown text to HTML, ODT, roff and other text formats. I also used quite a bit of awk and some sed code to get the template files working, which is something Hugo has that I really liked. Was honestly a bit of a headache, but that’s because I had never really learned to program in awk. Nevertheless, it was a great learning experience.

I then went on to make the RSS feed file generator, which was a huge pain; RSS XML has it’s own markup language for the <description> tag, and sadly pandoc cannot convert Markdown text to that, which made me put the project on hold for quite a while. When I got back to it a few months later, I checked some other people’s RSS feeds, and I stumbled upon an Atom feed file. I noticed that you can put literal HTML text in the <content> tag (Atom’s equivalent for the <description> tag in RSS) by making it a <content type="html"> tag instead. This was great and much much easier to implement: I could just get the output from lowdown, do some sed magic, and I would get an Atom-compliant text for the <content> tag. Atom feeds FTW!

This project has really simplified my life and workflow a lot. Everything is fast, everything is simple. For example, if I want to host my website locally, I can just run a single python command1 instead of needing stuff like browsersync or a more complicated SSG. Really simple stuff, and it really puts my mind at ease. I don’t need more, I guess :p

lowdown and Markdown in general are capable of so much stuff, to the point that I am genuinely convinced there’s no reason to still be writing HTML by hand nowadays, even if you want to have more control or whatever of your content. I understand why some people might wanna do it, maybe because of simplicity, or less tools being involved, but ironically you’d still need to put in some effort into configuring your text editor to make the process slightly less depressing. My point is, you never needed to deal with the annoying verbosity of HTML, because Markdown exists.

Here’s the git repo for the script. I will gladly appreciate any constructive feedbacks and contributions!


  1. $ python3 -m http.server -d path/to/root/folder/