So long, Wordpress

That’s it, I finally killed my Wordpress installation and moved the entire blog over to a static website generator.

After looking at a few frameworks I decided to go with Hexo. The config files took a few minutes to get used to, but thanks to the plugin system I managed to get almost everything I wanted.

# Migrating the old posts

To get my stuff out of Wordpress I used the XML export and a Python script I wrote[1] that converts the posts into Hexo-compatible markdown files. It also downloaded the embedded images and created the redirect directives so the old urls would still work.

The import went mostly fine, but I still have to go through many of the older posts to clean up the markdown.

# Theming

I went with a lazy color and font variation of the excellent Cactus Dark theme by Pieter Robberechts.

# Plugins, plugins, plugins

The great thing about Hexo is how easy it is to add more features to it. I ended up swapping the default markdown renderer for markdown-it-plus to get everything I need.

Syntax highlighting: just works!

1
2
def foo(syntax, highlighting='great'):
yield 'yay'

Footnotes: couldn’t live without them[2].

Custom HTML: Writing markdown is great and saves a lot of time, but sometimes you just need something more.

Latex math expressions: To be fair, I only used them in one blog post in 2009 and I honestly have no idea how to write them anymore, but it’s good that the blog supports it!

!(r g b)=α(r g b);0<α<1!\left(\begin{array}{c} r'\\\ g'\\\ b'\end{array}\right)=\alpha\cdot\left(\begin{array}{c} r\\\ g\\\ b\end{array}\right);0<\alpha<1

# What about comments?

That’s the only sad part so far. A static website has no commenting system. I thought about using Disqus, but since they now seem to run ads in the free plan, I decided against it. Maybe I’ll come up with a solution later.[3]

However, since the XML file included the old comments I was able to just bake them into the static markdown files, so they’re at least preserved for the future.

# Why spend all this effort

Guess it’s the same reason why everyone moves away from Wordpress in the end: maintainance just takes up too much work. Every other month you need to upgrade the CMS or the plugins to make sure all security holes are fixed. After a couple years you accumulate too many plugins so eventually something will break.

For me it was the login to the Wordpress admin. A while ago I was freaking out about someone breaking into my Wordpress – automatic bots try to login all the time – so I installed plugins protecting the login. I was even able to integrate my YubiKey! But last week, I guess some automatic update of something must have caused the whole setup to fail and I wasn’t able to get back in. It took me a couple hours to re-gain access to my own CMS[4].


  1. Well, I started using wp2md but then I ended up rewriting everything except Aaron Swartz'(!) html2text script ↩︎

  2. maybe without this one ↩︎

  3. for now, if you feel like getting in touch, shoot me a message on Keybase.io ↩︎

  4. which was very frustrating: 99% of the tutorials for resetting a wordpress password directly in the database are plain wrong (my blog wasn't using MD5 for hashing passwords) and I had to figure out how to disable all plugins ↩︎