I am building a Next.js app with internationalization using next-i18next.
// next-i18next.config.js
module.exports = {
i18n: {
locales: ['lv', 'en', 'ua'],
defaultLocale: 'lv',
localeDetection: false,
},
}
For better SEO, I wold like to use different URL params for same translated page.
Default NextJS page/locale mapping looks like this:
lv: /about-us
en: /en/about-us
ua: /ua/about-us
I would like to map this page like this:
lv: /par-mums
en: /en/about-us
ua: /ua/про-нас
Is it even possible?
Thanks!
4
Answers
Probably I don't have to worry about URL. In _app.js I have mapped localized versions of same page. So, SERPs should be aware of other versions.
...https://developers.google.com/search/docs/advanced/crawling/localized-versions
First of all im sorry that i don’t know how to get the language code
but i want you to give a try on this
like that
If you’re trying to create an internationalized static website with Next.js, make sure you’re aware of the limited export capability of Next.js:
There is a nice workaround for this: https://locize.com/blog/next-i18n-static/
btw: there is also another nice tutorial with examples here: https://locize.com/blog/next-i18next/
You can use exportPathMap. With this method you can generate different static html by language. Your static pages size will be grow as twice but it is works and no any impact page load speed.
Your custom Link Component:
your link:
in next.config.js
For running on locale add this in to next.config.js: