Bye Drupal, welcome Hugo

It has been a long time. Way too long. Update from update, Drupal was less and less a good solution for this website. I don’t update it that often, for starters. Secondly, Drupal was horribly slow and cumbersome. While I agree that Drupal can be an excellent choice for bigger websites, it’s simply not adapted to simple portfolio type websites. As a programmer, I was instanntly seduced by the approach of static sites generators: at last, my content would be easily viewable (the whole point of Drupal was to have the content separated from the HTML, as it was in the first iterations of the site). I setted on Hugo because I liked the fact it was fast, is using not to complicated templating system (even though it seems there is quite a bit different manners of doing the same thing) and is usable only with one executable. I don’t like the idea to pull the earth on my laptop just to compile a few webpages, going with go is perfect.

Pure HTML, CSS and JS: no more worrying about an horrible exploit that is suddenly found in a PHP CMS, and you did not update in time. Snappy, snappy renders. In fact it’s so fast it makes me love the web again. Not to mention that I am able to type this inside a plane, in a plain text editor of my choice, and I will be mirrored automatically when I have my connection back. Try to do this with traditional CMS.

However, as a programmer, it also mean I’m super lazy. While the content on my website is small and sparse, and I could just copy and paste it from the Drupal instance, I prefer to automate it as much as possible.

It turns out it’s not that complicated.

  1. First, install a Drupal plugin to export all the content to a .json file
  2. Write a simple python script that takes the content, converts it to markdown with html2text (optionnaly since plain html works fine, however I prefer having markup)
  3. All Drupal fields are converted to page properties. It allows to keep exactly the same structure. However, in the process I found that thanks to Hugo templating I could simplify my properties
  4. Write a theme that uses the properties
  5. Done!

I did not expect it to be so easy! So, from now on, your dedicated will be served as a pure generated website.

Another super cool fact about Hugo. I’m planning to be offline but still want to works on my template, so obviously I need the Hugo documentation (I have still nightmares of an internship where they asked me to do Delphi to C++ converter… without internet on the computer - not fun, ran as fast as I could). I immediatly checked, my go-to website for offline references (and online). However Hugo is not yet on devdocs. Well, turns out that you can git clone, hugo in the docs folder, then python -m http.server and boom! the full hugo docs for you waiting at http://localhost:8000/, everything works perfectly (but the search, I suspect another step is necessary).

What more could I ask for?