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.