Next.js developer in Brussels

Next.js 16 for a French and Dutch Brussels site: detect the language on the root only, hreflang per Google, static pages per language. Remote, in writing.

Next.js developer

My place in the WordPress community

  • I have had a wordpress.org account since 2006.
  • I contributed to WordPress core for versions 7.0 and 7.1.
  • I maintain 30 plugins on wordpress.org.
  • I organise and speak at WordCamps.
  • I have attended every WordCamp Europe from 2017 to 2026.

My WordPress.org profile

Brussels is where one URL has to answer two languages at once. The Belgian Constitution makes the Brussels-Capital Region bilingual, and a business site there usually has a French and a Dutch version. This page covers one technical question: how a Next.js site serves both without forcing visitors through language redirects, and without confusing Google. I am Mariusz Szatkowski, one person in Gdynia, Poland, and I deliver remotely and in writing.

#The setting

Article 4 of the Belgian Constitution says that Belgium has four linguistic regions: the French-speaking region, the Dutch-speaking region, the bilingual region of Brussels-Capital and the German-speaking region. For a site, that translates to a plain requirement: neither language is a side version.

#What Google says about language switching

Google’s page on managing multi-regional and multilingual sites is direct: avoid automatically redirecting users from one language version to another based on what you think their language may be, because that can stop both users and search engines from seeing all versions. Add links so users can pick another version themselves.

The page on locale-adaptive pages explains the crawler side. Googlebot’s default IP addresses appear to be in the USA, and it sends requests without an Accept-Language header. It also crawls from IP addresses outside the USA, and the guidance is to treat it like any visitor from that country. Google’s recommendation is separate locale URLs with hreflang annotations. Robots rules must be the same in every locale.

Put together: each language has its own stable URL, no deep URL changes language on its own, and the only place for automatic choice is the entry point.

The Next.js internationalization guide recommends reading Accept-Language and shows a proxy that redirects URLs without a locale. Its matcher can be narrowed to the root URL, and that is the shape I use in Brussels:

// proxy.ts
import { match } from '@formatjs/intl-localematcher'
import Negotiator from 'negotiator'
import { NextRequest, NextResponse } from 'next/server'

const locales = ['fr', 'nl']
const defaultLocale = 'fr'

export function proxy(request: NextRequest) {
  const header = request.headers.get('accept-language') ?? defaultLocale
  const languages = new Negotiator({ headers: { 'accept-language': header } })
    .languages()
    .filter((l) => l !== '*')
  const locale = match(languages, locales, defaultLocale)
  request.nextUrl.pathname = `/${locale}`
  return NextResponse.redirect(request.nextUrl)
}

export const config = { matcher: ['/'] }

The file is called proxy because Next.js 16.0.0 renamed the middleware convention, per the proxy reference. With the matcher set to /, a link to /nl/diensten is never touched, so a Dutch visitor who follows it stays in Dutch whatever their browser says.

There is a second option for the root: do not redirect at all and render a page with two links, French and Dutch. Google’s page on localized versions describes x-default as the fallback for language selectors and auto-redirecting home pages, so both options fit. The choice is a product decision. A chooser adds one click for everyone; a redirect saves it for most and gets it wrong for some.

#What next-intl does differently

If the project uses next-intl, its routing configuration covers the same ground, and its documentation is precise about the trade-offs:

  • With localeDetection: false, detection from the accept-language header and from a previous visit’s cookie is switched off, and the locale prefix alone decides.
  • When a user changes the language to a value that does not match the accept-language header, it sets a session cookie named NEXT_LOCALE. The documentation notes the cookie has no max-age by default, so it expires when the browser closes, and that it can be disabled with localeCookie: false.
  • It sets a Link header with alternates automatically, including an x-default entry for the root, which it reserves for language selection and detection, answered with a 307 redirect to the best match.

The cookie is the point where a Belgian site has a decision to make: a language preference cookie is still something stored on the visitor’s device. I name it in the scope so that you can decide where it belongs in your consent text.

#One static page per language

Both languages are built at deploy time with the pattern from the documentation:

// app/[lang]/layout.tsx
export async function generateStaticParams() {
  return [{ lang: 'fr' }, { lang: 'nl' }]
}

export default async function RootLayout({ children, params }: LayoutProps<'/[lang]'>) {
  return (
    <html lang={(await params).lang}>
      <body>{children}</body>
    </html>
  )
}

generateStaticParams accepts dynamicParams = false to return a 404 for anything else, such as /de. Strings come from one JSON dictionary per language loaded in a Server Component, which the guide says keeps translation files out of the client bundle.

#hreflang for fr and nl

Google’s localized versions page states the rules I follow: each version lists itself and all others, URLs are fully qualified including https, and if two pages do not point to each other the annotations are ignored. It also says that Google does not use hreflang or the HTML lang attribute to detect the language of a page. It uses its own algorithms, so the text on the page must be in the right language.

On the page level, Next.js renders hreflang links from the alternates.languages map in metadata. For a catalogue of many pages, I prefer the sitemap route, where each entry can carry an alternates map, so the whole set is generated from one list:

// app/sitemap.ts
export default function sitemap() {
  return [
    {
      url: 'https://example.be/fr/services',
      alternates: {
        languages: {
          fr: 'https://example.be/fr/services',
          nl: 'https://example.be/nl/diensten',
        },
      },
    },
  ]
}

Region codes are optional. Google’s example says that when you have several URLs for the same language in different regions, such as English for Ireland, Canada and Australia, you should also provide a generic one. A Brussels site with one French and one Dutch version does not need fr-BE or nl-BE. It needs them only if French for France or Dutch for the Netherlands also exist on the same site. The Next.js side of the same job for a Danish site is on the Copenhagen page, and the migration angle is on the Next.js to Astro migration page for Brussels.

#Checks before launch

CheckExpected result
/Redirects once, or shows the chooser
/fr/... and /nl/...200, no redirect, correct lang attribute
A deep link with the opposite browser languageStays in its own language
Unknown prefix such as /de404
AlternatesEach page lists itself and its twin, fully qualified
Root alternatesThe x-default entry is present in the built output
robots rulesThe same in both languages
Language switcherA real link on every page

#How a Brussels project runs

You send a written brief: the existing site or idea, both languages, who writes the Dutch and who writes the French, and the deadline. I reply with questions and a written scope with assumptions. I build on a staging URL, send each milestone with notes, and you accept in writing. I hand over a repository with documentation. The wider offer is on the Next.js to Astro migration overview and the headless CMS developer page.

Layouts and graphic design are your side, usually as Figma files or a wireframe spreadsheet. Calls and meetings are not part of how I work.

#Send me the brief

Write through the contact page with the site URL, both languages, the current stack and your deadline. The first estimate comes in writing and is free. I reply within 24 hours on working days (CET).

Buildings on the Grand-Place, Brussels

Photo: Diego Delso, CC BY-SA 4.0, Wikimedia Commons.

See also in Belgium

Need this service: Next.js developer in Brussels?

Describe your project by e-mail. I reply within 24 hours.

Describe your project

Explore other WordPress services and knowledge base