Hey folks I recently inherited a Hugo project that was stuck using the unmaintained klakegg containers and was on version 0.91.0 extended.
We wanted to update this to a more modern version (0.135.0 since I update versions monthly) but ran into some strange problems with how urls for translated pages were handled in links and by hugo serve
When using hugo serve
the output indicates the ports have been assigned as expected:
hugo | Web Server is available at //localhost:1314/ (bind address 0.0.0.0) en
hugo | Web Server is available at //localhost:1313/ (bind address 0.0.0.0) de
hugo | Web Server is available at //localhost:1315/ (bind address 0.0.0.0) fr
hugo | Web Server is available at //localhost:1316/ (bind address 0.0.0.0) nl
But the english pages are actually served on port 1313 but all links still point to 1314 and the the reverse was the case for the german pages
Similarly running a build rather than the local server results in the wrong baseurl for links.
We suspect something in how links are generated is broken by the changes in 112 or 123 related to how language params are accessed or the default link renderer but are not sure how to proceed debugging - can anybody suggest a diagnosis or solution ?
Our config loooks like:
{
"enableGitInfo": true,
"disableHugoGeneratorInject": true,
"markup": {
"goldmark": {
"renderer": {
"unsafe": "true"
}
}
},
"theme": "2020",
"title": "Uptrends",
"DefaultContentLanguage": "en",
"languages": {
"de": {
"languageName": "Deutsch",
"baseURL": "",
"languageCode": "de"
},
"en": {
"languageName": "English",
"baseURL": "",
"languageCode": "en"
},
"fr": {
"languageName": "Français",
"baseURL": "",
"languageCode": "fr"
},
"nl": {
"languageName": "Nederlands",
"baseURL": "",
"languageCode": "nl"
}
},
"Params": {
"de": {
"hstsImageUrl": "//uptrends.de/img/hsts.png",
"AnalyticsId": "nope",
"useNewAnalytics": true,
"gTagId": "nope"
},
"en": {
"hstsImageUrl": "//uptrends.com/img/hsts.png",
"AnalyticsId": "nope",
"useNewAnalytics": true,
"gTagId": "nope"
},
"fr": {
"hstsImageUrl": "//uptrends.fr/img/hsts.png",
"AnalyticsId": "nope",
"useNewAnalytics": true,
"gTagId": "nope"
},
"nl": {
"hstsImageUrl": "//uptrends.nl/img/hsts.png",
"AnalyticsId": "nope",
"useNewAnalytics": true,
"gTagId": "nope"
},
"CheckpointCount": "233"
},
}
}
with some menus ommited for simplicity and then a per environment config for baseurls
"languages": {
"de": {
"baseURL": "https://www.uptrends.de"
},
"en": {
"baseURL": "https://www.uptrends.com"
},
"fr": {
"baseURL": "https://www.uptrends.fr"
},
"nl": {
"baseURL": "https://www.uptrends.nl"
}
}
I’m happy to provide any other info but can’t share the repo directly