# Link are wrong when i deploy on Netlify

**URL:** <https://answers.netlify.com/t/link-are-wrong-when-i-deploy-on-netlify/9891>\
**Category:** Support\
**Tags:** deployment\
**Created:** [March 3, 2020, 7:49am UTC](https://answers.netlify.com/t/link-are-wrong-when-i-deploy-on-netlify/9891 "2020-03-03T07:49:06Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kyliux](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/kyliux/32/7445_2.png) [@Kyliux](https://answers.netlify.com/u/Kyliux)\
**Post date:** [March 3, 2020, 7:49am UTC](https://answers.netlify.com/t/link-are-wrong-when-i-deploy-on-netlify/9891/1 "2020-03-03T07:49:06Z")

</div>

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: [patia-78719d.netlify.com/en/en/gallery](http://patia-78719d.netlify.com/en/en/gallery).
- After clicking on gallery and then browse it, it duplicate the “gallery” word in the URL.

Here is the source code: [Kyliux / blog · GitLab](https://gitlab.com/Kyliux/blog/)  
Here is the page : [https://5e5df593c153dc000831d1b9--ecstatic-hypatia-78719d.netlify.com/](https://5e5df593c153dc000831d1b9--ecstatic-hypatia-78719d.netlify.com/)

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,

---

<div class="post-metadata">

**Author:** ![jen](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/jen/32/6044_2.png) [@jen](https://answers.netlify.com/u/jen)\
**Post date:** [March 3, 2020, 7:26pm UTC](https://answers.netlify.com/t/link-are-wrong-when-i-deploy-on-netlify/9891/2 "2020-03-03T19:26:39Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Kyliux](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/kyliux/32/7445_2.png) [@Kyliux](https://answers.netlify.com/u/Kyliux)\
**Post date:** [March 3, 2020, 7:31pm UTC](https://answers.netlify.com/t/link-are-wrong-when-i-deploy-on-netlify/9891/3 "2020-03-03T19:31:29Z")

</div>

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… 😕

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.

---

<div class="post-metadata">

**Author:** ![jen](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/jen/32/6044_2.png) [@jen](https://answers.netlify.com/u/jen)\
**Post date:** [March 5, 2020, 9:02pm UTC](https://answers.netlify.com/t/link-are-wrong-when-i-deploy-on-netlify/9891/4 "2020-03-05T21:02:24Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![mwenglein](https://avatars.discourse-cdn.com/v4/letter/m/ea5d25/32.png) [@mwenglein](https://answers.netlify.com/u/mwenglein)\
**Post date:** [May 12, 2020, 7:42am UTC](https://answers.netlify.com/t/link-are-wrong-when-i-deploy-on-netlify/9891/5 "2020-05-12T07:42:31Z")

</div>

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:

[http://localhost:1313/#history](http://localhost:1313/#history)  
[http://localhost:1313/de/#history](http://localhost:1313/de/#history)

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

[http://localhost:1313/de/de/#history](http://localhost:1313/de/de/#history)

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

---

<div class="post-metadata">

**Author:** ![jen](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/jen/32/6044_2.png) [@jen](https://answers.netlify.com/u/jen)\
**Post date:** [May 12, 2020, 6:59pm UTC](https://answers.netlify.com/t/link-are-wrong-when-i-deploy-on-netlify/9891/6 "2020-05-12T18:59:10Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![mwenglein](https://avatars.discourse-cdn.com/v4/letter/m/ea5d25/32.png) [@mwenglein](https://answers.netlify.com/u/mwenglein)\
**Post date:** [May 13, 2020, 7:49am UTC](https://answers.netlify.com/t/link-are-wrong-when-i-deploy-on-netlify/9891/7 "2020-05-13T07:49:09Z")

</div>

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:

[http://localhost:1313/#history](http://localhost:1313/#history)  
[http://localhost:1313/de/#history](http://localhost:1313/de/#history)

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.

Thanks!!

---

<div class="post-metadata">

**Author:** ![fool](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/fool/32/37_2.png) [@fool](https://answers.netlify.com/u/fool)\
**Post date:** [May 14, 2020, 11:48pm UTC](https://answers.netlify.com/t/link-are-wrong-when-i-deploy-on-netlify/9891/8 "2020-05-14T23:48:12Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![michaelwenglein](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/michaelwenglein/32/39336_2.png) [@michaelwenglein](https://answers.netlify.com/u/michaelwenglein)\
**Post date:** [July 15, 2022, 9:06am UTC](https://answers.netlify.com/t/link-are-wrong-when-i-deploy-on-netlify/9891/9 "2022-07-15T09:06:53Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![hrishikesh](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/hrishikesh/32/74607_2.png) [@hrishikesh](https://answers.netlify.com/u/hrishikesh)\
**Post date:** [July 17, 2022, 1:14pm UTC](https://answers.netlify.com/t/link-are-wrong-when-i-deploy-on-netlify/9891/11 "2022-07-17T13:14:39Z")

</div>

Not sure what to tell you @michaelwenglein, from Netlify’s perspective, you’re indeed linking it incorrectly:

 ![image](https://global.discourse-cdn.com/netlify/original/3X/7/6/760045b894bfbba3866e1168e70c21e6072d14c2.png)

Is the Hugo version used locally same as that on Netlify?

---

<div class="post-metadata">

**Author:** ![michaelwenglein](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/michaelwenglein/32/39336_2.png) [@michaelwenglein](https://answers.netlify.com/u/michaelwenglein)\
**Post date:** [July 17, 2022, 1:53pm UTC](https://answers.netlify.com/t/link-are-wrong-when-i-deploy-on-netlify/9891/12 "2022-07-17T13:53:30Z")

</div>

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…

---

<div class="post-metadata">

**Author:** ![hrishikesh](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/hrishikesh/32/74607_2.png) [@hrishikesh](https://answers.netlify.com/u/hrishikesh)\
**Post date:** [July 17, 2022, 2:05pm UTC](https://answers.netlify.com/t/link-are-wrong-when-i-deploy-on-netlify/9891/13 "2022-07-17T14:05:07Z")

</div>

> [@michaelwenglein](#):
>
> Can you reproduce the error in the live site though?

Yes

> [@michaelwenglein](#):
>
> 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

---

<div class="post-metadata">

**Author:** ![michaelwenglein](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/michaelwenglein/32/39336_2.png) [@michaelwenglein](https://answers.netlify.com/u/michaelwenglein)\
**Post date:** [July 17, 2022, 2:58pm UTC](https://answers.netlify.com/t/link-are-wrong-when-i-deploy-on-netlify/9891/14 "2022-07-17T14:58:10Z")

</div>

Done. It’s two repos, one for the site and one for my fork of the template theme.

---

<div class="post-metadata">

**Author:** ![hrishikesh](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/hrishikesh/32/74607_2.png) [@hrishikesh](https://answers.netlify.com/u/hrishikesh)\
**Post date:** [July 17, 2022, 3:05pm UTC](https://answers.netlify.com/t/link-are-wrong-when-i-deploy-on-netlify/9891/15 "2022-07-17T15:05:59Z")

</div>

The problem is because, in your root `config.toml`, the base path is `/`. I changed it to `https://www.wenglein.de/` which fixed it.

I’ve opened a PR.

---

<div class="post-metadata">

**Author:** ![michaelwenglein](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/michaelwenglein/32/39336_2.png) [@michaelwenglein](https://answers.netlify.com/u/michaelwenglein)\
**Post date:** [July 27, 2022, 7:15pm UTC](https://answers.netlify.com/t/link-are-wrong-when-i-deploy-on-netlify/9891/16 "2022-07-27T19:15:41Z")

</div>

Oh my. Thank you very much and sorry for all the hassle then. Quite obvious indeed…
