20
Internationalization - Content redirection by slug/id
g
guicsou-lw
The main issue behind this is that I can not (natively) find the content I want based on slug/ID + locale.
For example, I have the same blog post translated to three languages, Strapi creates three different posts and map them. This mapping works well on the Strapi admin dashboard, however it is a struggle to use the API.
Example:
post-pt
post-en
post-es
When querying a specific post, like 'post-en' for example and passing the locale 'es', GraphQl doesn't return me anything because the locale does not correspond to the slug requested.
I'd like to redirect the content to the specific locale, this way I can always have the translated content without manual injection.
This way, if someone selected the English language in the website and (for some reason) is redirected to a content in another language, the user will always see content his language.
Nicholas Bérubé
I currently work around this by adding a field "common_slug" to my collection types on which I disable localization for.
I have a "slug" field that is localized that I use to show a different url for each locale.
Ex. example.com/en/blog/my-first-blog
example.com/fr/blog/mon-premier-blog
When I query my english blog, I can get the french blog's slug using the "common_slug" and the blog's locale.
Rortan
Any updates on this?
Ahmed Eid
+2 for this. We want to have localized slugs that are good for Google search results.
C
Chris
+1 for this. We want to have localized slugs that are good for Google search results. When the user hits a foreign page by accident we want to redirect them to the correct slug.