Erik Bernhardsson    About

Meta-blogging

(This is not a very relevant/useful post for regular readers — feel free to skip. I thought I would share it so people can find it on Google.)

My blog blew up twice in a week earlier this year when I landed on Hacker News. The first time I was asleep so I didn’t notice that the site went down. The second time I did notice, and scrambled to reconfigure Apache & MySQL to handle the load.

I decided it was time to move off Wordpress.

This is something I had been thinking for a long time — I hated the layout with my old site, especially the typography. I probably could have spent a bunch of time tweaking it but it also feels philosophically wrong to run a LAMP stack in 2016 for something as simple as a blog.

After some research I chose Jekyll. I liked the idea of static content and it seemed very lightweight. To do this I had to

  1. Clone Poole
  2. Install the Wordpress to Jekyll exporter
  3. Run this simple postprocessing script I had to build for some cleanup
  4. Fixup a couple of things with Poole (in particular add height: auto; to the img tag in _sass/_base.scss, everything else was cosmetic superficial stuff, mostly to get nice serif fonts that seems to be the shit recently).

Additionally I reconfigured some stuff around related pages (brew install gsl, gem install rb-gsl, set lsi: true in _config.yml). LSI is a pretty crappy algorithm for NLP but unfortunately there’s nothing better out there.

Since the entire state is stored in the file system, I also use Github to host a repo with the blog in it. I’m still hosting the blog on a Digitalocean droplet, but might kill it and just switch to Github Pages at some point.

Page load time went down drastically after deploying it:

Pingdom stats

This was all good until and I was running happily on my new blog until I was checking Feedly. First it claimed that I was no longer subscribed to my own blog, then when I added it, my number of subscribers had dropped from 300 to 9. WTF! I realized it’s because my previous RSS was broken. I ended up setting up some 301 redirects using Apache. First of all, in /feed/.htaccess

RedirectMatch 301 /feed/(.*) http://erikbern.com/atom.xml

This will redirect /feed/ to atom.xml. Then I moved index.php to wordpress.php and set this up in /.htaccess:

RewriteEngine On

RewriteCond %{QUERY_STRING} feed=
RewriteRule (.*) /atom.xml? [R=301,L]

RewriteCond %{REQUEST_URI} ^/$
RewriteCond %{QUERY_STRING} p=
RewriteRule (.*) /wordpress.php [R=301,L]

The first pattern will redirect /?feed=xyz to atom.xml. The last one is for old links to my blog — it will do a double 301, from /?p=841 to /wordpress.php?p=841 to /2014/11/29/deep-learning-for-chess/.

I’m now up to 230 readers on Feedly — not sure wtf is going on but seems better than 9. Please resubscribe if you lost it!

Erik Bernhardsson

... is the CTO at Better, which is a startup changing how mortgages are done. I write a lot of code, some of which ends up being open sourced, such as Luigi and Annoy. I also co-organize NYC Machine Learning meetup. You can follow me on Twitter or see some more facts about me.