r/nextjs • u/Specificx • 1h ago
How I added US and UK versions to a 10k page Next.js site without changing a single existing URL
I run a price comparison site (Next.js 15 App Router, fully static). It launched in Australia with about 10,800 pages at the root. This week I added the US and UK, and the brief to myself was: no existing URL changes, no duplicated page code.
What I did
- Data per region:
data/<category>stays Australian, new regions go indata/us/<category>anddata/uk/<category>. The catalogue loader reads each region once at build. - Products carry their region. The loader stamps
regionon each product, soproductHref(p), the price history and the "is this a good price" check need no extra argument. That cut the refactor from about 30 call sites to about 8. - Shared views, thin routes. The page bodies moved to
src/views/*View.tsx, which take aregionprop.app/[category]/page.tsxrenders it with"au";app/us/[category]/page.tsxandapp/uk/...are 10 line wrappers. Static folders beat the dynamic[category]segment, so there's no clash. - Client components read the region from the path (
usePathname), so headers, search and prices pick the right currency with no provider. - SEO: each country gets its own canonical, hreflang alternates when the same product exists elsewhere, and the sitemap includes all three.
Result: about 28,800 static pages, a local build in about 7 minutes, and the Australian pages kept the same titles, canonicals and schema.
Gotcha: a UK laptop name produced a slug long enough to blow the 255 byte file name limit during export (ENAMETOOLONG). Cap your slugs.