Goodbye Drupal, welcome Hugo!

15 years ago I migrated this website to the popular CMS Drupal. At first I loved Drupal, it was a nice and shiny tool for managing my content without having to deal with designing the appearance of the site. Over the years, however, I realized that running a dynamic website also has a cost, and that cost is keeping the software that drives the site up-to-date. With Drupal that cost is substantial: Security updates are constantly pouring in, and upgrading Drupal to a major new version invariably also means a major amount of work to be done. The latest upgrade to Drupal 8 in 2018, for instance, took me about two weeks to complete!

To be fair, not every one of the Drupal upgrades I went through (4.7 → 5.1 → 6.14 → 7.14 → 7.50 → 8.5.6 → 8.6.13 ) has been this much work. Nevertheless over time I developed a deep loathing of tackling Drupal upgrades because every time a nasty surprise was practically guaranteed. The reason usually was that third-party modules and themes were not ported to the new version, sometimes even years after the new Drupal version had been released. As a consequence I began to avoid themes and modules unless they were extremely popular and well-maintained and therefore likely to be ported to new Drupal versions.

Alas, even core Drupal functionality which I happened to use (manual teaser break and link fields) began to fail me in Drupal 8. I’m not a web developer, but I still managed to submit detailed bug reports and even patches on two occasions (this and this), but even after 2½ years these patches have not been integrated, and somehow I doubt that they ever will. For instance this bug report, submitted in 2010, regarding the no longer working manual teaser break was never acted upon in Drupal 7 even though this is about core functionality.

To make a long story short, a few weeks ago I made the decision that I would not go through another Drupal migration. I started looking around for static website generators, and after about half an hour of clicking through the alternatives on jamstack.org I unscientifically decided to go with Hugo. Maybe I should have considered Jekyll, but I didn’t.

I then started to research how I can liberate the data that Drupal held captive in its database. In the end I wrote a PHP script drupal2hugo.php which uses the Drupal API to extract the data and write it to Hugo files. The script is based on Fredrik Jonsson’s work which he published in this xdeb.org post. I adapted Fredrik’s script to my own needs and also to the Drupal 8 API. If you’re interested you can find drupal2hugo.php in my personal tools Git repo.

Disclaimer: The script is a one-time effort and it worked for me (™) so it’s unlikely that I will make any more changes to it. Feel free to copy and adapt it in whichever way you like.

The main thing that is missing after the migration is comments. I migrated existing comments from Drupal, but for new comments readers have to write me an email. My email address is in the footer on each page of this website.