grahl/ch

Switching from Drupal to Spress

This site was powered by Drupal for a full decade. It went through Drupal 5, 6, 7 and 8, but it’s outlived its usefulness in that form. I think it might have even begun as a 4.7 site.

Why

My reasons for switching to a static site generator are quite plain but highlight my shifting needs:

  • Over 3/4 of posts here contain a code snippet, this is vastly easier to handle with Markdown or similar tools, than CKEditor.
  • The content is by all accounts static. The end-user is not rewarded through interactive features but rather burneded by the wait time of the CMS overhead. Even with the dramatically improved page cache in D8, it doesn’t come close to plain HTML.
  • I don’t have nontechnical users to support here.
  • I have enough other Drupal sites in my life to use for trying out new modules and experimenting.
  • I can stop maintaing a server to have things as flexible and speedy as I like, for a minor site.
  • And finally: All posts are revisioned in Git, without any intermediate systems.

How

My choice fell on Spress even though it’s not that prevalent (yet), since it uses the stack I’ve come to appreciate everywhere else: Symfony, Twig, Composer.

Converting data is straightfoward and easy. Just write a quick script to fetch all nodes and output their fields as desired.

League’s HTML-to-Markdown library easily converted CKEditor HTML with only minor corrections necessary afterwards.

Then just write it to a file with fopen/fwrite/fclose. Yes, of course that could be done more elegantly, but for a single migration it works fine.

Along the way I pruned the content back to what could still be considered tangentially relevant. I look forward to seeing if this will make posts here more frequent, as I expect, the opposite, or neither.