For a few weeks now, I use Hugo as blog generator. Previously, I used Pelican and it was beginning to get on my nerves: it was getting slower and heavier.

Maybe related to the 203 articles. I needed a better system.

The Plus side !

First of all, it is more powerfull. But not only…

Pages entirely translated

I could never managed, in Pelican, to translate my theme entirely. There were here and there mixed french or english sentences.

In Hugo, I did it !

Tags and categories names are translated

Under Pelican, tags and categories were all shared between languages. So I was using transparent or fabricated words to classify correctly. Hence Informatics, which is not a real word, but I thought could pass ok.

In Hugo, tags and categories are not shared between languages.

The Minus side.

I got a few regressions, indeed.

No more archives !

I do not have anymore yearly, monthly, daily archives.

It was quite classy, when looking for an article in a definit year or month, to just go to the date URL /year/month/ and have a nice list over posts. It is a frequent request from Hugo’s users. Let’s hope developpers manage to implement it.

Dates only in english.

Publication dates are presently only available in english. Too bad.

Summary function is not top of the pop.

Hugo has a Summary function, allowing to display the 70 first words of an article on the homepage. It breaks all page settings. Or you have to manually define where to put the break in the markdown source.

So I use this solution in my customized theme.

Theme

I had to translate my Pelican theme to Hugo. It was not simple at times, but I did it. It is available here, under ISC licence.

The theme has the following functions:

  • summary
  • logarythmic tag cloud (Ceci impose que les tags soient bien écrits dans le frontmatter, sans erreur de syntaxe.)
  • Isso support
  • Social networks’ logos are actually just pictures, not trackers.
  • If you provide tipeee or liberapay logins, buttons with links towards the accounts are displayed at the top of the sidebar.
  • Blogroll and local links in the sidebar setup via json files in the data repository.

nginx redirection

Under Pelican, my URL were of this form : /year/month/day/titke-lang/. Today, my URL become /lang/year/month/day/title/. In order not to break all external links to my blog, I add to setup URL redirections and rewriting.

# Set back language first
location ~* ^/([0-9]+)/([0-9]+)/([0-9]+)/(.*)-en/$ {
    try_files /en/$1/$2/$3/$4/ /en/;
    }

location ~* ^/([0-9]+)/([0-9]+)/([0-9]+)/(.*)-da/$ {
    try_files /da/$1/$2/$3/$4/ /da/;
    }

location ~* ^/([0-9]+)/([0-9]+)/([0-9]+)/(.*)-fr/$ {
    try_files /fr/$1/$2/$3/$4/ /fr/;
    }

# Rewrite tags and categories, beginning with english
location ~* ^/tag/(.*).html$ {
    try_files /en/tags/$1/ /fr/tags/$1/;
    }

location ~* ^/category/(.*).html$ {
    try_files /en/categories/$1/ /fr/categories/$1/;
    }

location ~* ^/downloads/$ {
         autoindex on;
    }

As stated before, under Hugo, tags’ and categories’ URL are not shared between languages. This is the reason why, when the URL does not correspond to an actual scheme, I try first in english, then french.

in the dk

By the way, I actually have two domain names. 22decembre.eu and 22december.dk. The last one gives a direct access to the danish part of the blog. That is actually just /da/. Except that a lot of things at the root of eu are not at the root of dk (this last one being actually just the /da/ subdirectory). There I need also a rewriting :

rewrite ^/da/(.*)$ /$1;

So https://www.22december.dk/da/tags/arbejde/ (URL read by the browser) become https://www.22december.dk/tags/arbejde/. In the eu website, it stays https://www.22decembre.eu/da/tags/arbejde/.