Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tomsoderlund/nextjs-multi-domain-locale
Hosting multiple domains on the same Next.js site (while maintaining multiple languages and SSG)
https://github.com/tomsoderlund/nextjs-multi-domain-locale
domains i18n nextjs ssg
Last synced: 2 days ago
JSON representation
Hosting multiple domains on the same Next.js site (while maintaining multiple languages and SSG)
- Host: GitHub
- URL: https://github.com/tomsoderlund/nextjs-multi-domain-locale
- Owner: tomsoderlund
- License: other
- Created: 2021-04-09T07:55:10.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2021-04-15T07:23:31.000Z (over 3 years ago)
- Last Synced: 2024-08-01T22:45:21.480Z (3 months ago)
- Topics: domains, i18n, nextjs, ssg
- Language: JavaScript
- Homepage: https://multi-domain-locale1.vercel.app/
- Size: 77.1 KB
- Stars: 227
- Watchers: 4
- Forks: 20
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# nextjs-multi-domain-locale
> Multiple domains and languages on the same Next.js site
This is an example of hosting **multiple domains on the same Next.js site** (while maintaining **multiple languages** and [static site generation (SSG, getStaticProps)](https://nextjs.org/docs/basic-features/data-fetching#getstaticprops-static-generation)), using [Next.js’ i18n system](https://nextjs.org/docs/advanced-features/i18n-routing).
## Demo
[https://multi-domain-locale1.vercel.app/](https://multi-domain-locale1.vercel.app/)
## Concept
- Domain mapped to Next.js’ i18n `locale` is used to determine the _site_.
- _Language_ is instead handled via a `pseudoLocale` prop (pages inside a `/[pseudoLocale]` folder).
- A _redirect_ from `/` to `/en`.
- TODO: Automatic language detection using the [Accept-Language header](https://nextjs.org/docs/advanced-features/i18n-routing#automatic-locale-detection).See `next.config.js` for setup.