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 )
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?
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…
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.
No apology necessary at all! We’re also always learning new stuff (and making mistakes in the process ) 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.
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?
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.
Hi @Jen sorry for not getting back earlier! I had the multi-language temporarily disabled to cover up the issue. However, it’s still unresolved. I’ve reactivated the DE language and my site ID is 32daf64e-becb-4a32-9de6-9f6292cd3538
Yes, it’s the same. And yes, when running locally all is fine, just like your screenshot. Can you reproduce the error in the live site though? It has to happen somewhere during deployment…
That would be a problem with Hugo then, as Netlify is doing nothing special - just executing the Hugo binary, waiting for it to finish, and deploying the generated files.
We would most likely have to ask for your repo, but debugging on a code-level is usually out of our scope of support.
You can share it with me for now though. GH Username: Hrishikesh-K