johannschopplich / kirby-vue3-starterkit

✨ Kirby + Vue SPA starter: automatic routing, i18n, SEO and more!
MIT License
206 stars 19 forks source link

Language code duplication in URL causes error page redirection #20

Open TobeyEh opened 3 years ago

TobeyEh commented 3 years ago

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 commented 3 years ago

Hi Tobey, I'm looking into it.

leawinleawin commented 1 year ago

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 commented 1 year ago

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