kirby-vue3-starterkit icon indicating copy to clipboard operation
kirby-vue3-starterkit copied to clipboard

Language code duplication in URL causes error page redirection

Open TobeyEh opened this issue 3 years ago • 3 comments

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?)

TobeyEh avatar Apr 14 '21 18:04 TobeyEh

Hi Tobey, I'm looking into it.

johannschopplich avatar Apr 22 '21 05:04 johannschopplich

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.

leawinleawin avatar Mar 21 '23 14:03 leawinleawin

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. 🙂

johannschopplich avatar Mar 21 '23 17:03 johannschopplich