Fix i18n: use localePrefix: never to serve default locale at root
This commit is contained in:
@@ -3,5 +3,5 @@ import { defineRouting } from 'next-intl/routing';
|
|||||||
export const routing = defineRouting({
|
export const routing = defineRouting({
|
||||||
locales: ['sr', 'en'],
|
locales: ['sr', 'en'],
|
||||||
defaultLocale: 'sr',
|
defaultLocale: 'sr',
|
||||||
localePrefix: 'as-needed'
|
localePrefix: 'never'
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -4,5 +4,10 @@ import { routing } from './i18n/routing';
|
|||||||
export default createMiddleware(routing);
|
export default createMiddleware(routing);
|
||||||
|
|
||||||
export const config = {
|
export const config = {
|
||||||
matcher: ['/((?!api|_next|_vercel|.*\\..*).*)']
|
// Match all pathnames except for
|
||||||
|
// - /api routes
|
||||||
|
// - /_next (Next.js internals)
|
||||||
|
// - /_vercel (Vercel internals)
|
||||||
|
// - all root files inside /public (e.g. /favicon.ico)
|
||||||
|
matcher: ['/((?!api|_next|_vercel|_next/static|_next/image|favicon.ico|robots.txt|sitemap.xml).*)']
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user