0
0
NextJSframework~5 mins

Domain routing for locales in NextJS - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is domain routing for locales in Next.js?
Domain routing for locales lets you serve different languages or regions from different domains or subdomains automatically based on the user's locale.
Click to reveal answer
beginner
How do you configure domain routing for locales in Next.js?
You add a 'domains' array inside the 'i18n' config in next.config.js. Each domain object specifies the domain name and the defaultLocale it serves.
Click to reveal answer
intermediate
Example of a domain configuration for French locale on 'example.fr'?
In next.config.js: { domains: [{ domain: 'example.fr', defaultLocale: 'fr' }] } inside the i18n config.
Click to reveal answer
intermediate
What happens if a user visits a domain not listed in the domain routing config?
Next.js falls back to the default locale and domain specified in the i18n config or redirects based on your setup.
Click to reveal answer
intermediate
Why use domain routing for locales instead of path-based locale routing?
Domain routing provides a cleaner URL without locale prefixes and can improve SEO by targeting specific country domains.
Click to reveal answer
Where do you configure domain routing for locales in Next.js?
Apublic folder
Bpages/_app.js
Cnext-env.d.ts
Dnext.config.js inside the i18n object
What key do you use to specify the domain for a locale in Next.js config?
AlocaleDomain
Bdomain
Chost
Dsite
If you want 'example.de' to serve German content, how do you specify it?
A{ domain: 'example.de', defaultLocale: 'de' }
B{ domain: 'de.example.com', locale: 'de' }
C{ host: 'example.de', locale: 'de' }
D{ domain: 'example.de', locale: 'en' }
What benefit does domain routing provide over path-based locale routing?
AShorter URLs without locale prefixes
BSlower page loads
CRequires no configuration
DWorks only on localhost
What happens if a user visits a domain not configured for any locale?
AThe site crashes
BUser is redirected to Google
CNext.js uses the default locale
DThe page shows a 404 error
Explain how to set up domain routing for locales in a Next.js project.
Think about where Next.js config lives and how locales are defined.
You got /4 concepts.
    Describe the advantages of using domain routing for locales compared to path-based locale routing.
    Consider URL appearance and search engine benefits.
    You got /4 concepts.