There is a new static site generator on the block.. also hello world..

Update (2021): guess what, I’m back to hugo.. Not necessarily because I started to dislike the idea of oblivious, I think it still is a pretty interesting concept and I particularly love the idea of being able to create a site, while having minimal dependencies and being pretty much language agnostic. The reason I switched was that on the one hand I got a bit more involved with NixOS, which seems to be even better suited to some of the things oblivious ended up taking care of (such as fetching resources) and on the other hand I just want to be able to publish something by pressing a bunch of keys without having to actively maintain the underlying tooling.

If you wan to check out how my site looked like with oblivious, then you can head over to the blogs repo, checkout any commit preious to 6b200fa5c8c91719f615884f79d7e2163c0c7433 and drop the files into a webserver using e.g.:

python3 -m http.server

I guess I’ll just keep this online in case anyone finds this interesting, anyways, I hope you enjoy:

Over the last weekend and a half, I’ve spent quite some time writing oblivious, which is essentially a little static site generator written in bash and org-mode and emacs-lisp.

Previous to writing oblivious I looked at other blogging solutions, I actually already tried using org-mode combined with ox-hugo in the past. While ox-hugo definitely does it’s job I ended up spending quite a big amount of time with

  • theming the whole thing,
  • being annoyed with the go templating language,
  • using the wrong version of hugo
  • generally trying to figure out how to use ox-hugo
  • manually downloading Javascript and CSS files so I could serve them locally

While both hugo as well as ox-hugo are really nice projects, using it I found myself thinking about how nice it would be to have a native way to create a static site directly from within Emacs.

There are actually quite a bunch of options when it comes to creating websites using Emacs and org-mode, I’ve tried some of them out and finally settled with the built-in org-publish, which is what I’m using now.

But you’ve just said you’ve written your own static site generator!

Well yes, but actually no. I lied, kind of.. but maybe just bear with me for a while, it’ll make sense eventually.

I haven’t written a static site generator, that would have been a really bad idea, after all I’m an utter illiterate when it comes to web development and up until this point I’ve basically just cargo culted my way through all of the web-development parts of creating this website. I’ve used org-publish in order to generate everything, because it’s a nice little built-in and basically just works out of the box.

So what is oblivious then?

Basically oblivious is a small little command line application you can use to [automatically] create a website.

Emacs and org-publish still do the heavy lifting, when it comes to the actual export of your org-files. oblivious takes care of a few other quality of life things, such as:

  • injecting your org-publish configuration into your Emacs configuration, which is an utterly bad and gruesome idea in general, but it was kind of cool to simply “infect” my own config instead of having to take care of it elsewhere (you can actually use whatever export backend you prefer with oblivious)
  • housekeeping tasks: such as configuring the .gitignore file or setting up the git user
  • fetching (even building) external resources, such as Javascript or CSS
  • triggering emacs in batch mode in order to load or tangle the configuration of a website

All of the configuration of a site resides in a single org file, which is then tangled and/or loaded into everything necessary to create a site.

Inside of the configuration file you define settings such as the value for #+author, ways to automatically fetch resources you need and templates for parts of the site.

Whenever you change the configuration file, you run oblivious sync in order to generate all the templates etc and oblivious fetch, whenever you need to download resources. Using oblivious build you can then start a batch export, which creates your static site.

How exactly you set up your site is still pretty much up to you, but IHMO using oblivious basically provides you with a similiar interface to what you may know from using some of the more common static site generators, while at the same time being org-mode, emacs-lisp and bash under the hood.

If you’re intrigued and want to look at the gory details, I suggest you head over to the oblivious repo and look at the readme.org file, which is where I keep a detailed configuration of how this site was built at that time.

Oh and also hello world!