Help › Install on your site

Install on Next.js

Partly builtLast updated

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#

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#

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.