Install on Astro
On this page
The Astro integration runs when astro build finishes. It writes translated copies of your pages under a language prefix such as /fr/.
Setup#
In astro.config.mjs, set your site address and add the resilientLang integration with:
- your source language,
- the folder that holds your published bundle,
- your public key,
- your site key, the loader address and the public key for the loader tag.
Your site setting becomes the base for hreflang and canonical addresses. These must be full addresses, because search engines expect that.
Behaviour#
- The integration uses Astro's
astro:build:donestep, which Astro documents as receiving the output folder and the list of pages. - Astro leaves a script tag that has attributes other than
srcalone when you mark itis:inline. That is how the loader tag should be added to your own layout. - Astro ships static HTML, so translated copies are marked so that the loader leaves them alone.
- Islands hydrate only their own part of the page. An island that draws its own text can still replace a translation inside it. Test your interactive parts.
- The manifest signature and file checksums are checked. A bad signature stops the build.
Security policy#
Astro 6 can write a content security policy as a meta tag with hashes (security.csp, off by default). Scripts from other addresses, such as the loader, need to be allowed in its settings.
Not covered#
Pages made on demand are not prerendered. No search-engine crawl of the output has been done: OPEN. The integration is not published to npm: OPEN.