Skip to content
This repository has been archived by the owner on Aug 31, 2023. It is now read-only.

Language code duplication in URL causes error page redirection #20

Open
TobeyEh opened this issue Apr 14, 2021 · 3 comments
Open

Language code duplication in URL causes error page redirection #20

TobeyEh opened this issue Apr 14, 2021 · 3 comments

Comments

@TobeyEh
Copy link

TobeyEh commented Apr 14, 2021

Hi there! I ran into an issue with the router when setting up a multi-language site.

When pointing a link from a non-top-level url to a top-level url it redirects to the error page. This is because it appends the language code twice.

<router-link  
    :key="contact.uri"
    :to="`/${contact.uri}`"
>

or using a hardcoded path

<router-link  
    :key="contact.uri"
    :to="{path: '/contact'}"
>

or using "../"

<router-link  
    :key="contact.uri"
    :to="{path: '../contact'}"
>

So when you're on www.example.com/en/projects/house
and from there want to link to www.example.com/en/contact
it redirects to www.example.com/en/en/contact and thus goes to the error page.

Does it have something to do with the base url being built with the languageCode inside the router js file?

Thanks for any input!

Edit NOTE:
This only happens when deployed, it doesn't happen on localhost dev. (Maybe a Vite thing?)

@johannschopplich
Copy link
Owner

Hi Tobey, I'm looking into it.

@leawinleawin
Copy link

Hi, did you have any chance to look into the issue? It would be happy for any hint how to solve it as I am currently working on a multi-language setup and can't get the language switch to work.

@johannschopplich johannschopplich changed the title Multi-language: linking from a non-top-level url to a top-level url appends language code twice and thus redirects to the error page Language code duplication in URL causes error page redirection Mar 21, 2023
@johannschopplich
Copy link
Owner

Hey there,
glad to see you're using this setup. Unfortunately, I'm not actively maintaining it anymore (especially the multi-language setup). I have evolved it into my headless Kirby and Nuxt starter for better SEO etc. Feel free to look into that, it also covers all of your i18n needs.

If you require this issue to be resolved for your current project, you can book me for consulting and I will fix it. Drop me a line via email if you are interested. 🙂

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants