Astro 6.1 is here! Astro 6.1 gives you global control over image encoding with codec-specific defaults for Sharp, so you can configure JPEG, WebP, AVIF, and PNG settings once in your Astro config instead of on every image.
Explore what’s new in this release:
- Sharp codec-specific image defaults
- Advanced SmartyPants configuration
- i18n fallback routes for integrations
- Smoother view transitions on mobile
- Vite 8 compatibility warning
- React hydration fixes
- CSRF protection behind reverse proxies
To upgrade an existing project, use the automated @astrojs/upgrade CLI tool. Alternatively, upgrade manually by running the upgrade command for your package manager:
# Recommended:npx @astrojs/upgrade
# Manual:npm install astro@latestpnpm upgrade astro --latestyarn upgrade astro --latestSharp codec-specific image defaults
Sharp, Astro’s built-in image service, has always supported fine-grained encoding options — mozjpeg compression for JPEG, effort levels for WebP and AVIF, compression levels for PNG. Sharp’s defaults work great for most projects, but if you needed consistent encoding settings across a large number of images, the only option was to set them on every <Image /> individually.
Astro 6.1 adds image.service.config to set codec-specific defaults once in your Astro config, applied to every image processed during the build:
import { defineConfig } from 'astro/config';
export default defineConfig({ image: { service: { config: { jpeg: { mozjpeg: true }, webp: { effort: 6, alphaQuality: 80 }, avif: { effort: 4, chromaSubsampling: '4:2:0' }, png: { compressionLevel: 9 }, }, }, },});Per-image quality still takes precedence when set, so global defaults and per-image overrides work together without conflict. See the image service configuration reference for the full list of supported options.
Advanced SmartyPants configuration
If your Markdown content targets a non-English audience, you’ve probably noticed that SmartyPants — the library Astro uses to automatically convert punctuation into its typographic equivalents — assumes English conventions. French guillemets («»), German quotation marks („"), or old-school em-dash handling weren’t possible without disabling SmartyPants entirely and handling it yourself.
Astro 6.1 opens up the full SmartyPants configuration, so you can customize each transformation individually:
import { defineConfig } from 'astro/config';
export default defineConfig({ markdown: { smartypants: { dashes: 'oldschool', openingQuotes: { double: '«', single: '‹' }, closingQuotes: { double: '»', single: '›' }, ellipses: 'unspaced', quotes: false, }, },});See the retext-smartypants options for the full list of supported settings.
i18n fallback routes for integrations
Astro 6.1 exposes fallbackRoutes on every route in the astro:routes:resolved hook, giving integrations access to the additional routes Astro generates for locales that don’t have their own content when using fallbackType: 'rewrite'.
{ 'astro:routes:resolved': ({ routes }) => { for (const route of routes) { const fallbacks = route.fallbackRoutes.map((f) => f.pathname); console.log(route.pathname, '->', fallbacks); // '/about/' -> ['/fr/about/', '/de/about/'] } }}We’ve already put this to use in @astrojs/sitemap, which now automatically includes i18n fallback pages in the generated sitemap. Previously, these routes were invisible to integrations, meaning fallback pages were silently missing from your sitemap.
Learn more about i18n fallback routing in the Astro docs.
Other improvements
- Smoother view transitions on mobile — The client router now skips view transition animations when the browser is already providing its own visual transition, such as a swipe gesture on iOS Safari. This eliminates the double-animation flicker that could occur when navigating back and forward with gestures. (#16025)
- Vite 8 compatibility warning — Astro now warns on dev server startup when Vite 8 is detected at the top level of your project. The
astro add cloudflarecommand also automatically adds a"overrides": { "vite": "^7" }entry to yourpackage.json, preventing a common crash when using packages like@tailwindcss/vite. (#16062) - React hydration fixes — Multiple fixes for React hydration errors, including conditional slot rendering and
experimentalReactChildrenmismatches. (#15378, #15146) - CSRF protection behind reverse proxies —
checkOriginnow correctly readsX-Forwarded-Protoduringastro devwhen behind a TLS-terminating reverse proxy, preventing false 403 errors on form submissions. (#16043)
For a complete list of bug fixes and smaller improvements, see the full changelog.
Community
The Astro core team is:
Alexander Niebuhr , Armand Philippot , Chris Swithinbank , Emanuele Stoppa , Erika , Florian Lefebvre , Fred Schott , HiDeoo , Luiz Ferraz , Matt Kane , Matthew Phillips , Reuben Tier , Sarah Rainsberger , and Yan Thomas .
Thanks to all the other contributors who helped make Astro 6.1 possible with code and docs additions and improvements, including:
0xRozier, Adam Matthiesen, Adam Page, Ahmad Yasser, AitorMT, Alex Dombroski, B Sai Thrishul, bashrocks, Ben Limmer, Bernd Strehl, Burra Karthikeya, Calvin Liang, chaegumi, Chase McCoy, Corbin Crutchley, Daniel Bodky, Daniil Sivak, Dario Piotrowicz, dataCenter430, Dawid Gaweł, Desel72, Em Poulter, Eveeifyeve, farshad, Felix Schneider, Felmon, fkatsuhiro, Giray, Gokhan Kurt, Greg L. Turnquist, hank00111, Haz, Jack Lukic, jahndan, Jason P. Cochrane, Jimmy, Junseong Park, Kedar Vartak, Kevin Z, Koji Wakamiya, Kumar Gautam, Kyle McLean, ld-web, Leif Marcus, Louis Escher, Martin Trapp, Matthew Justice, Natan Sągol, Oliver Speir, oliverlynch, Ossaid, paul valladares, Paweł Grzybek, pierreeurope, Rafael Yasuhide Sudo, Raymond Camden, Sakku 🦉, Sam Richard, Sanjaiyan Parthipan, Sebastian Beltran, Shinya Fujino, Sora, Tay, teinett, Thomas Bonnet, Tom Callahan, Tomasz Cz-Sokołow, Tristan Bessoussa, Vagno, vrabe, Will (liruifengv), xyamzw, Yevhen Amelin, マルコス, and もっちー

