Install on Next.js
On this page
The Next.js kit translates your site after next build. It writes a translated copy of every page under a language prefix such as /fr/. The copies include hreflang tags, a canonical tag and the loader tag.
What it needs#
- A static export: set
output: 'export'in your Next.js settings. Next.js writes plain HTML only in that mode. Next.js's static export page documents no step that runs after the export, so the kit runs as a second command (absence from the documentation, not a statement by Next.js). - A published bundle for your site, downloaded into a folder such as
./rl-bundle. The command-line tool can fetch it. See The command-line tool. - Your public key and your site address.
Setup#
In next.config.js, wrap your settings with withResilientLang. In package.json, change the build script to next build && rl-next.
Add a resilientlang.config.json with public values only: the source language, your site address, the bundle folder and your public key. The kit refuses a secret key (rl_sec_).
Checks the kit makes#
- The manifest signature is mandatory. An unsigned or tampered bundle stops the build.
- Every language file is checked against its checksum.
- If no origin can be reached, the build keeps your source-language output and warns. A bad signature always stops the build.
Why translated pages are plain HTML#
Next.js hydrates its pages in the browser. A translated page that hydrates can be turned back into the source language. The kit therefore removes the framework scripts from the translated copies by default. The translated pages are static. Interactive parts of those pages do not run.
Security policy on a static export#
A static export cannot set response headers. Next.js says a nonce needs pages rendered on request, so it cannot be used here (checked 2026-10-29). If you want a content security policy, set it on your host and allow the loader address. See Content security policy.
What is not covered#
Pages made on demand at request time are not prerendered. Text drawn by JavaScript is left to the loader, if it runs. No real search-engine crawl of the output has been done: OPEN. The kit is not published to npm: OPEN.