Website Changes: 2004–2014

Over the Easter break I spent some time making changes to this blog so that the posts from 2004 through to 2014 are displayed in the style in which they were originally posted rather than the current theme. This might seem like an odd thing to do: these old designs do not conform to modern layout standards, nor are they optimised for the typical screen resolutions in use today. However, as I looked through the older posts, some of them had visual oddities where the original formatting had not translated properly to a new theme, and even when the formatting was OK, there was something odd about reading text written 15 years ago but presented in an up-to-date way.

Method

I was able to implement this by creating a directory structure for the older years and populating it with static files for the older posts. The default WordPress configuration means that if these files and directories exist then they are served instead being given to WordPress to render dynamically. The easiest way to generate the static pages is to use the Preload setting of the WordPress Super Cache plugin, then copy the files it generates from wp-content/cache/supercache to the correct location. Before doing this you should review your theme to make sure that any time-sensitive dynamic content (for example, an instagram feed) is turned off, otherwise the generated pages will remain stuck with today’s content which which may look rather odd in a few months time.

One problem I encountered is that my initial approach broke some of the auto-generated year archive pages (e.g. /tooBusy/2005). The monthly archive pages were produced consistently, but the year ones were sometimes missing. I used the curl command to fill in the missing ones, but it also highlighted that any private posts will no longer appear in these year and month archive pages when you are logged in, although they will be shown in other views such as tags and categories.

Executing this for posts using two older themes, presented a slightly harder problem. I did not want to reconfigure my live website while I experimented with this setup, so I spun up a copy of WordPress on my laptop using Docker and loaded into it a backup of my live website. I then used the WP2Static plugin which, in addition to generating the files, can also post-process them to change any references to the web server running on my laptop to the correct one.

I reviewed many, but not all, of the generated files—if you spot any problems, please let me know. Getting a good quality result using an offline copy of the website took considerably more time and effort than I hoped, but looking through those older posts I am struck by how much better many of them look in their original style, while I find the current theme to be equally good for more recent posts. WordPress continues to offer a first-class writing experience for new posts, and the fact that the same software is still running this blog after 16 years is a triumph of longevity and backwards compatibility. The existence of practical solutions for migrating away from it are just another point in its favour.