Astro boosts HTML file control, i18n support

Astro 4.3 web framework improves control over HTML file output and adds experimental domain support for international locations.

retro astronauts with rocket on planet
Thinkstock

Another update to the Astro web framework for content-driven websites has arrived. Only weeks since the release of Astro 4.2, Astro 4.3 brings more control over HTML file output and adds experimental domain support for different international (i18n) locales.

Astro 4.3 was introduced February 1. Developers can upgrade Astro using the following command:

npx @astrojs/upgrade

More control over HTML file output is enabled by a new build.format option, called preserve, that offers more control over the resulting HTML files in a production build. This option will preserve file system structure and ensure it is mirrored over to production. The feature offers better compatibility with some web servers with strict requirements on structuring of files.

Astro 4.3 also adds an experimental domains i18n configuration, for specifying different domains or subdomains for different supported locales. Developers, for example, now could use example.com for an English site, fr.example.com for a French site, and example.es for a Spanish site. Developers can enable the experimental flag, i18nDomains, and map locales to domains using i18.domains in the astro.config.mjs file.

In other improvements in Astro 4.3, the framework adds a ComponentProps type export from Astro/types to get the props type of an Astro component. This type export allows developers to reference the Props accepted by another component, even if that component does not export the Props type directly.

Finally, the standard ![](img.png) now can be used in Markdown files for images colocated in the same folder, with no relative specifier required. Astro 4.3 release notes can be found on GitHub.

Copyright © 2024 IDG Communications, Inc.