Einar's blog
04 aug. 2022

I now use org-static-blog to create this blog

I have moved from WordPress to Hugo to nothing and now on to org-static-blog to create this blog. One reason to move to org-static-blog is that I have switched from using vim to using GNU Emacs as my text editor. When I used Hugo, I wrote my blog posts in vim and Hugo made it into a bunch of static pages that I uploaded to my webserver. Hugo has many features, like themes, RSS feeds, tags etc and is very practical to use if you use markdown on a regular basis. Since I was a vim user, my idea was to use markdown for everything and use Hugo for my website and pandoc to convert my .md files into LaTex-styled PDFs, LaTex Beamer presentation PDFs, ODTs and the occasional .docx when needed. I converted most of my older documents to .md and worked like this for a while. Then my Emacs curiosity got the better of me, and this spring, I started dipping my feet into Emacs.

I soon realised the power of Org Mode and that it could replace my former markdown workflow with practical features like automatic tables, lots of easy to use keyboard shortcuts for creating the .org markup syntax and very easy exporting to all the aforementioned formats plus many more. Not to mention that it is also a calendaring and todo-system, that it includes a REPL for any programming language you care for that you can use for literate programming, that it can also be used for journaling, a personal note taking system with reverse-linking etc. Naturally, I have been looking for a way to write my blog posts in Org Mode as well. Many people use Hugo and just convert their .org files to .md files with the emacs package ox-hugo. To me, this seems to be one step more than what I would actually like to do and what is actually necessary. After the war in Ukraine started, I left my website with just a static HTML page, but I have recently wanted to get back into blogging. I had started to work on making a program to make a static site from a bunch of .org files when I discovered the Emacs package org-static-blog that did the same. My plan with my program was to make it first in Bash Shell since I am more familiar with that language and then move it to Elisp for easy integration with Emacs later. Org-static-blog made all that work unecessary.

Org-static-blog makes a nice index page with a blog-roll of the newest pages, an archive page and an RSS feed. You may also add links to other static pages you would like to include. If you use the tags feature, you can also get RSS feeds for each tag. Personally, I want to just keep things simple for now and have opted out of that feature. To make a new post, you just write an .org file with a title and date and optionally also a description and file tags metadata on the top and then just write your content. Each .org-file becomes a blog post. You can also use org-static-blog-create-new-post to automatically make that document with the correct tags for you which is nice for people like me that have yet to start using metadata heavily in Org files and would enjoy a helping hand with that.

When you are ready to publish your blog, you just run org-static-blog-publish in Emacs, and org-static-blog spits out all the HTML-files you need in your chosen export folder. To make the site look nice, you should make a style.css file that you put into your export folder and link to it in your header as described in the README. There are no themes, but the author links to his own website's Git repo where you can grab his style.css and tweak it to your own liking. As a dark mode lover that also likes to keep things simple, I have opted for a simple black and white look with the occasional light blue for links. The CSS styling is set it and forget it, so after the initial tweak, you are good to go. Just org-static-blog-publish and upload your static files to your website and there you go.

org-static-blog.png

The advantage of using a static site generator over something dynamic is faster load times, easier access to content for non-JavaScript enabled users and less storage space and CPU used on your server. Not having unecessary JavaScript running just to show some content that is easily accessible without it also saves power which is good both for the environment and the economy. There are more non-JavaScript users than you think out there and everyone else also benefits from faster load times. Everyone that browses with the NoScripts extension (which I highly recommend) is a non-JS user by default. Everyone that browses from such an old machine that even if JS is enabled, the capacity to actually run it is limited (both due to old browsers and lack of CPU and RAM resources) can also be considered non-JS users in practice. (When I use the Quadra 700 to browse the internet with Clasilla, most sites look like garbage and are unrenderable.) Everyone that blocks non-free JavaScript with LibreJS, which is recommended by the FSF, is also a non-JS user unless you make certain the only JS used by your site is free software (which can be hard to achive if you use WordPress with a theme that does not care). The last group of non-JS users are users like me who like to use text-based, non-JS browsers combined with an RSS reader for feeds that do not supply the whole text to the RSS entry. I generally try in eww, Emacs built in browser, first if I come from an RSS feed I have read in elfeed (an Emacs package for RSS feed reading). I have made an elisp function to be able to hit b to read a feed entry in eww and if that doesn't work, I hit B for Firefox instead. Many vim users use lynx or w3c, two other non-JS, text-based browsers, together with the Newsboat RSS reader program in the same way. It was what I did before switching my feed reading to elfeed.

All blog content is licensed under the Creative Commons Attribution-ShareAlike 4.0.