Translated slugs

@ZeroEqualsZero @lorenzo.defrancesco

Here, i created a project that uses the same demo in the Nexti18n blog, but the slugs are all translated
You can se a demo of the site here:
https://fabulous-maamoul-5057cf.netlify.app/
You can see from this URLs the translated slugs:

https://fabulous-maamoul-5057cf.netlify.app/posts/mistakes-tourists-make-on-their-first-trip-abroad
https://fabulous-maamoul-5057cf.netlify.app/it/posts/gli-errori-che-i-turisti-fanno-durante-il-loro-primo-viaggio-all-estero

You can see the repository i used right here: GitHub - marcelofinamorvieira/datocms-next.js-i18n-blog-demo-with-translated-slugs

The most important change can be found on the getStaticPaths function in this file: datocms-next.js-i18n-blog-demo-with-translated-slugs/[slug].js at master ยท marcelofinamorvieira/datocms-next.js-i18n-blog-demo-with-translated-slugs ยท GitHub where i loop through the locales and get the localized slug instead of just using the english slug for all paths.

And the DatoCMS project i used right here (keep in mind you will have to attach the new repository to this project)

Clone DatoCMS project

1 Like