Summary: How website-next-js replicates Nuxt’s nuxtI18n.paths per-locale URL slugs in a Next.js Pages-Router app deployed via output: 'export'. Translated slugs at the page level (for example /konto for de, /compte for fr, /account for us) can’t go through middleware: they need sibling page files, a shared component, and a central slug table.
Sources: website-next-js port of pages/account and pages/login (commits 40e2442, 622aa43); cross-checked against nuxt-website for the original nuxtI18n.paths blocks. 2026-11-09: re-checked against website-next-js origin/main (lib/i18n/sectionSlugs.ts, lib/i18n/locales.ts, lib/storyblok/fetchPages.ts, lib/build/previewPaths.ts, the page files under pages/[locale]/, functions/_middleware.ts)
Last updated: 2026-11-09
When this applies
Any Next.js page whose Nuxt 2 ancestor declared nuxtI18n.paths. The ported families, all in lib/i18n/sectionSlugs.ts:
account: de/konto, fr/compte, es/cuenta, every other locale/accountpayments(the subscription management page): de/abo-verwalten, fr/gerer-labonnement, it/gestire-abbonamento, es/gestionar-suscripcion, uk/ca/us/manage-subscription, no nllogin: de/anmelden, fr/connexion, es/iniciar-sesion, it/accedi, nl/inloggen, uk/ca/us/loginresetPassword(the reset request page): de/passwort-zuruecksetzen, fr/reinitialisation-du-mot-de-passe, es/restablecer-contrasena, it/reimposta-la-password, uk/ca/us/password-reset, plus the locale-agnostic alias/auth/reset-passwordmagazin,wissen,podcast: content sections with the same shape (de/magazin, fr and us/magazine)
The login and reset-password families now only redirect. Login and password reset moved to frontend-public-pages. functions/_middleware.ts 302s a direct hit on any of these slugs to app.<domain>/login or app.<domain>/reset-password before the page renders. The page files remain for client-side navigation from CMS content, which never reaches the edge. Their bodies are components/auth/LoginRedirectPage.tsx and components/auth/ResetPasswordPage.tsx. /me/reset-password, the link target in reset e-mails, still renders a real form here.
The en locale stays in the slug tables but is not built (LOCALES in lib/i18n/locales.ts filters it out; /en/* 301s to www.7mind.app).
If you find a Vue page with nuxtI18n.paths declared, the React port has to honour those slugs. The visible URL is part of the site’s SEO and bookmark surface; collapsing every locale onto the English slug is a regression.
Why middleware won’t do it
In Nuxt 2 the nuxt-i18n module owned URL translation at the router level: a single page file declared its per-locale slugs and the router served them up. In Next.js with output: 'export', that doesn’t work for two reasons:
- Native i18n config is incompatible with
output: 'export'. Thei18nblock innext.config.ts, which would have given us locale-aware routing, can’t be combined with static export. - No server renders at request time. The CF Pages deploy is static HTML. The
functions/_middleware.tsPages Function rewrites hostnames to locale folders, but it can only serve files that exist, so every translated path must already exist inout/.
So the slug translation has to materialise at build time as actual files in out/. That means one Next.js page file per unique slug.
The pattern
Three pieces.
1. Central slug table
SECTION_SLUGS in lib/i18n/sectionSlugs.ts owns every family’s per-locale slug map. A locale missing from a family’s map means the page isn’t routable in that locale. The helpers there are sectionSlug, sectionLocales, sectionIndexHref and sectionEntryHref. sectionIndexHref returns a prefix-less path such as /abo-verwalten, because each production host serves one locale at its root. Never hardcode a translated slug in component code; go through these helpers.
2. Shared page component
The page body lives in components/<area>/<Page>.tsx, not in pages/. For example, pages/[locale]/account/index.tsx, konto/index.tsx, compte/index.tsx and cuenta/index.tsx all render components/account/AccountPage.tsx. The shared component reads the current locale with useLocale() and builds in-page links through the slug helpers. Links into frontend-public-pages go through lib/appDomain.ts instead: a logged-out visitor on /konto is sent to app.<domain>/login by goToLogin(), with the current page as the return target.
3. Per-slug page files (thin wrappers)
Each unique slug gets a small page file under pages/[locale]/<slug>/index.tsx that declares which locales render at this slug and loads the message slices (see static-export-i18n-catalogue). A single-locale slug such as konto lists only de in getStaticPaths. A shared slug such as account derives its locales by filtering SECTION_SLUGS.account for entries equal to account, so adding a locale to the table doesn’t require touching the wrapper.
Every getStaticPaths first calls previewSkipPaths() (lib/build/previewPaths.ts), which returns no paths in the Storyblok preview build. New page files must do the same.
Don’t forget the catch-all exclusion
The Storyblok catch-all (pages/[locale]/[...slug].tsx) enumerates every Storyblok story slug across all locales as a static path. If editorial ever creates a Storyblok story with slug account or konto, the build crashes with Conflicting paths returned from getStaticPaths. We hit this exact failure on CF Pages when the /success page was added without an exclusion.
The defence is isExcludedCatchAllSlug() in lib/storyblok/fetchPages.ts. It lists every page-owned slug (all the families above, plus coupon, purchase, mondia, teilnahmebescheinigung, barmer and krankenkasse routes) and is shared with lib/storyblok/catchAllIndex.ts, so both use the same list. Add the slug there whenever you add a new translated page file, even if Storyblok doesn’t have a story at that slug today.
Cost
Per translated page family, you write:
- 1 entry in
SECTION_SLUGS - 1 shared
components/<area>/<Page>.tsx(the body) - N page files under
pages/[locale]/<slug>/index.tsx, where N is the number of unique slugs across locales (typically 3 to 6) - N entries in
isExcludedCatchAllSlug
For account: 1 shared component and 4 page files (account, konto, compte, cuenta). For login: 1 shared component and 6 page files. For payments and reset password: 5 page files each, plus the /auth/reset-password alias.
That’s tedious but mechanical, the right scope for an agent to handle in one pass. Don’t try to be cleverer (dynamic route segments, runtime redirects, etc.); the boilerplate per file is small enough that the flatter structure is clearer.
Caveats
router.asPathcarries the locale prefix. Because Next.js doesn’t know about the CF Pages Function rewrite,router.asPathis/de/konto, not/konto. When you need the URL-bar path, readwindow.location.pathnameor strip the prefix withstripLocalePrefix()fromlib/i18n/locales.ts. See multi-domain-hostname-rewriting for the analogous concern in the Nuxt repo.useLocale()reads fromrouter.query.localein the React port, notrouter.locale(which is always undefined underoutput: 'export'). All locale-driven logic must go through the hook.- Internal links are plain page loads. The client router can’t resolve prefix-less paths, so
SMMLinkrenders internal links as full navigations and the edge adds the locale prefix.
See also
- nuxt-website: the source
nuxtI18n.pathsdeclarations on the Vue side. - static-export-i18n-catalogue: how the wrappers load their copy at build time.
- multi-domain-hostname-rewriting: analogous “Nuxt does this for us, but in static export we have to do it ourselves” pattern, applied to the backend hostname rewrite that let
7mind.de,6mind.de, and8mind.deshare a build.