Link are wrong when i deploy on Netlify

Dear community,

I have some issues with the links that behave differently when I deploy my Hugo website locally and on Netlify, I don’t understand why, but locally it work perfectly fine.

The problem is probably with i18n since I want to make my website multilangual. The issue comes when you click on the EN flag and then try to browse the gallery ( top nav bar )

Description of the problem :

  • After clicking on the english flag and then the gallery button the url use twice the “en” in the URL:
  • After clicking on gallery and then browse it, it duplicate the “gallery” word in the URL.

Here is the source code:
Here is the page :

Key files are the following

“layout/gallery/branch” for the gallery"
“layout/partial/nav.html” for the navbar"

Any help would be greatly appreciated !

Thank you,

Hi there! It looks like you might be hard-coding the href when clicking the english flag- so you append /en/ to the URL and it stays whenever you click on anything else, and gives you /en/en/gallery instead of /en/gallery (which is what you want). Is it possible to use Hugo’s absLangURL syntax on the english flag button the way you do for the gallery button?

Thank you Jen, I will see if it changes anything.

This being said, I have doubt since when I surf the gallery, I find myself with links like /gallery/gallery/australia, so it’s not the flagname “en” that seems to be repeated but really the middle part of the URL. ( after the .fr et before the last string )

Also I probably need to apologize, am probably coding very clumsily since am still discovering things on Hugo, but I can’t understand why locally it’s working and not on netlify… :confused:

EDIT : Well I think that adding a slash will solve the issue temporarly. I will also rewrite completely the image gallery because it’s not well done.

I will close this threat, thank you.

No apology necessary at all! We’re also always learning new stuff (and making mistakes in the process :sweat_smile:) over here. Thanks for coming back and letting us know what fixed things for you- let us know if we can help with anything else down the road.

Hi jen, I have the same symptoms despite using absLangURL as intended:

{{ i18n “menu_history” }}

I’m linking to an anchor on a single-page website, which - on my local build - results in one of the following URLs depending on the current language:


On Netlify, the second link is coming out with a double /de/de despite no hard-coding anywhere:


Any idea where the second language slug could be coming from?

Hey @mwenglein, could you share your Netlify URL so we can check out your build settings? One thing to check in the meantime is: if you run hugo locally to output your built site, and then view your site in a browser (so, not with hugo server), are the paths correct or do they have the extra path appended?

Hi @jen, on my local build everything is fine, as written above, the links come out with a single language slug as expected when using absLangURL:


When using absLangURL on Netlify staging (built from a pull request) everything works perfectly fine, just as in my local environment. The double /de/de only occurs on my live URL.

Btw, my baseURL is set as recommended in your specification:

baseURL = “/”

The repo is private. Please PM or send me an email if you need further details.


Feels a bit like there’s a redirect on that site. Mind telling us which site you’re working with so we can look at it in place? If you aren’t comfortable sharing your site name, it is safe to share your Site’s API ID, found on the “general settings” page, publicly.