So here is it 🎉, the fourth iteration of my scarcely updated web page / blog. To recap previous versions:
1.0 (lates 90’s?): A long, long time ago. Was basically made by manual PHP includes. Probably used animated gifs and a visit counter.
2.0 (2004?): Migrated tu Drupal.
3.0 (2009): Migrated to Django with some modules. In the 11 years since this migration, the site went trough several revisions including moving stuff to Docker and moving to a self-hosted solution instead of AWS and a couple total reworks of the stylesheet and design.
As you can see, the 3.0 version with Django, with some updates, held for a long time. It was really nice to be able to write or manage articles using Django’s admin but by 2020 there were several serious problems with it:
Since the computer where the site was hosted is a puny old Intel NUC with the power of a thin potato, I wanted to generate and serve static content. I managed to do it with Django sprinkling some more modules (really, there are Django modules for everything) but it was a little unwieldly to manage, specially once you factor everything being into docker containers.
The Django version used was ancient and migrating to a modern version would imply a migration to Python 3 of my code. Also, not all the modules I used were migrated to Python 3 so I would either have to migrate those, find (and learn, and configure) replacements or write my own replacements.
So considering that I would basically would need to rewrite the entire codebase to update it to a newer version and I was already generating static content, it made sense to check static content generators. Which I didn’t really do because I had used Hugo in the past and I liked it, so I selected it for this site.
The migration itself was surprisingly easy. Instead of taking the probably better way of writing a script to extract all the stuff and metadata from Django’s database and regenerating the content with the format and file structure that Hugo expected (a header over the markdown files and all that) I took the lazy way:
Removed all styling stuff from the Django templates leaving the bare HTML without headers, footers or anything else.
Got a list of all the posts’ URLs from the DB, using the very nice Django’s ORM.
Retrieved all these URLs with a 5 lines Python script.
Did some more further processing (removing more HTML to leave only the content inside the body, remove all the classes and ids, remove some divs, et cetera). I also did this with a Python script, using the very nice BeautifulSoup4 module. And finally added Hugo’s header over each file.
Moved all the images to Hugo’s static directory and updated the content.
A little Hugo’s configuration, basically choosing the theme and a few other things.
It took about 2 hours in total which is not bad as these things go.
About Hugo, I must say that even while I don’t have much experience with other static content generators, I really like this one. It’s simple to use and configure, it’s fast and most defaults just make sense. I also like that I removed two docker containers and a lot of code and configuration from my server and now nginx just serves the generated content directly, which is both fast and resource-light.
Other changes in this version:
Removed the Disqus comments. While there were some interesting comments, specially on the more technical posts, the signal to noise ratio (with noise here being spam or “write my homework” kind of comments) was too high. Also, Disqus have some privacy concerns (tracking) and slowed the page load. If you still want to contact me you can do it at juanjo at juanjoalvarez dot net.
Removed a lot of outdated content. And by outdated I mean very, very outdated.
Simplified the design even more. This is a path I’ve been following over the years with this site, which started as a very complicated setup with columns, sideboxes, navigation header, et cetera. Currently, as you can see, the site is as minimalist as it can get, just the content and nothing more. And I like it (trough I’ll probably add a nicer logo). I did zero work of CSS or HTML by the way, just used Mino theme.
Now, I only need to write more content…