Dynamic alternate urls and use with localePath (e.g. for using @nuxt/i18n with a headless CMS) #2709
Replies: 3 comments 15 replies
-
Your proposed solution works the same as the I'm not sure if I understand your use case exactly, the issue I closed related to translating parameters but your examples seem to be about translating routes, not its parameters. |
Beta Was this translation helpful? Give feedback.
-
So my basic solution to this is that inside your translation files you add the param for the API so for example
(sorry if there is a mistake in the syntax, just doing it out of the hand.) |
Beta Was this translation helpful? Give feedback.
-
Facing the same issue but in my case:
Issue I am facing:My alternate links are generated for the current slug - but not using the other translated slugs. Of course, because I have no manipulated the logic to use the translated slugs. I looked at this method: https://i18n.nuxtjs.org/docs/guide/custom-paths#page-component Which would have been pretty handy in my case, where I could simply do something like: defineI18nRoute({
paths: {
'en-US': `/posts/${data?.value?.data?.attributes?.localeSlugs.en}`,
'es-ES': `/posts/${data?.value?.data?.attributes?.localeSlugs.es}`,
'de-DE': `/posts/${data?.value?.data?.attributes?.localeSlugs.de}`,
}
}) But it doesn't work for me. The generated i18n alternate links are still only using the For now I am thinking about just ignoring the alternate & canonical links for my blog-pages but that is not the best solution, if I want to optimize my SEO ranking for my blog. |
Beta Was this translation helpful? Give feedback.
-
@BobbieGoede
I saw, that you locked issue #2100. Maybe i'm wrong, but
setI18nParams
seems to only be able to set the translated URLs only for the current route. I assume this enables functionality forswitchLocalePath
. But what about multilinugal linking to another dynamic page (e.g. vialocalePath({ name: 'products/red-mug' })
).I feel for complete support of e.g. headless CMSs a function should be provided, that can set all translated paths of all routes at the start of the app (e.g. in
app.vue
) - to achieve the same funtctionality as described on https://i18n.nuxtjs.org/guide/custom-paths).I have proposed a solution at #2100 (comment).
Beta Was this translation helpful? Give feedback.
All reactions