惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

www.infosecurity-magazine.com
www.infosecurity-magazine.com
D
DataBreaches.Net
T
Tailwind CSS Blog
M
MIT News - Artificial intelligence
Stack Overflow Blog
Stack Overflow Blog
F
Full Disclosure
V2EX - 技术
V2EX - 技术
N
News and Events Feed by Topic
Help Net Security
Help Net Security
L
LangChain Blog
Y
Y Combinator Blog
宝玉的分享
宝玉的分享
Google Online Security Blog
Google Online Security Blog
P
Proofpoint News Feed
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
T
The Blog of Author Tim Ferriss
Google DeepMind News
Google DeepMind News
The Register - Security
The Register - Security
B
Blog RSS Feed
N
Netflix TechBlog - Medium
N
News | PayPal Newsroom
TaoSecurity Blog
TaoSecurity Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
V
Vulnerabilities – Threatpost
B
Blog
C
Cyber Attacks, Cyber Crime and Cyber Security
I
Intezer
H
Hackread – Cybersecurity News, Data Breaches, AI and More
博客园_首页
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
AI
AI
aimingoo的专栏
aimingoo的专栏
大猫的无限游戏
大猫的无限游戏
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Cyberwarzone
Cyberwarzone
P
Proofpoint News Feed
Google DeepMind News
Google DeepMind News
G
GRAHAM CLULEY
Vercel News
Vercel News
罗磊的独立博客
MyScale Blog
MyScale Blog
Last Week in AI
Last Week in AI
博客园 - 司徒正美
C
CERT Recently Published Vulnerability Notes
GbyAI
GbyAI
Scott Helme
Scott Helme
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
T
Troy Hunt's Blog
A
About on SuperTechFans
P
Privacy International News Feed

The Astro Blog

Astro 6.4 Astro 6.3 Starlight 0.39 Astro 6.2 What's new in Astro - April 2026 What's new in Astro - March 2026 Astro 6.1 CloudCannon Joins Astro as an Official CMS Partner Astro 6.0 What's new in Astro - February 2026 What's new in Astro - January 2026 Astro 5.17 Supporting the future of Astro The Astro Technology Company joins Cloudflare Astro 6 Beta What's new in Astro - December 2025 What's new in Astro - November 2025 Astro 5.16 Stainless Sponsors Astro, Launches Astro-Powered Docs Platform What's new in Astro - October 2025 Astro 5.15 Spirit of Astro: meet the winning designs What's new in Astro - September 2025 Astro 5.14 Cloudflare Donates $150,000 to Support Astro's Open Source Mission Webflow Donates $150,000 to Support Astro's Open Source Mission Mux: Our Official Video Partner Unleashing creativity: How CodeTV built a video streaming platform with Astro and Mux | Astro What's new in Astro - August 2025 Astro 5.13 What's new in Astro - July 2025 Astro 5.12 Starlight 0.35 Astro 5.11 What's new in Astro - June 2025 Live Content Collections: A Deep Dive Introducing… Astro Mart Astro Solstice Festival Astro 5.10 Astro 5.9 What's new in Astro - May 2025 Astro 5.8 What's new in Astro - April 2025 2025 Technical Steering Committee Starlight April Update Astro 5.7 Astro Agency Partner Program Astro 5.6 What's new in Astro - March 2025 Astro 5.5 What's new in Astro - February 2025 Astro 5.4 Starlight 0.32 Astro 5.3 What's new in Astro - January 2025 Astro 5.2 2024 year in review What's new in Astro - December 2024 Astro 5.1 Astro 5.0 Google IDX: Our Official Online Editor Partner What's new in Astro - November 2024 What's new in Astro - October 2024 Astro x Cloudinary SDK What's new in Astro - September 2024 Community Loaders for Astro Content Layer Astro x Hygraph: Content Loader Astro x Cloudinary: Content Loader Astro x Storyblok: Content Loader Content Layer: A Deep Dive Starlight 0.28 Astro 5.0 Beta Release The $100,000 Astro Ecosystem Fund Fall Update Goodbye Studio, Hello DB What's new in Astro - August 2024 Astro 4.15 Astro 4.14 Astro 4.13 What's new in Astro - July 2024 Astro 4.12: Server Islands Netlify: Our Official Deployment Partner What's new in Astro - June 2024 Astro 4.11 Astro Together 2024 Server Islands The Astro Content Layer Zero-JavaScript View Transitions Astro 4.10 Starlight turns one year old! What's new in Astro - May 2024 Astro 4.9 Astro 4.8 What's new in Astro - April 2024 Astro 4.7 Astro 4.6 What's new in Astro - March 2024 Migrating 500+ tests from Mocha to Node.js Astro DB: A Deep Dive The Astro Developer Portal Astro DB
Astro 4.2
Erika, Emanuele Stoppa, Matthew Phillips, Nate Moore, Bjorn Lu · 2024-01-18 · via The Astro Blog

Astro 4.2 is now available! This release includes new experimental features to try out, improvements to accessibility rules, the ability for remark plugins to customize image optimization in Markdown, and many more improvements and bug fixes.

Highlights include:

  • (Experimental) Support for prerendering pages using the Speculation Rules API
  • (Experimental) Reworked routing priority for injected routes
  • New redirectToDefaultLocale config option
  • Improved accessibility rules
  • Customizable image optimization in Markdown

This marks the first Astro release of almost all community-built features, with only one highlight brought to you by an Astro core maintainer. This is a huge milestone for us, as it means that Astro is now big enough to have a thriving community of contributors capable of spearheading releases. Thank you to everyone who contributed to this release!

How to upgrade

To take advantage of the latest features, make sure you’re running the latest version of Astro. You can upgrade to Astro 4.2 by running the @astrojs/upgrade command:

or by running the upgrade command for your package manager:

npm install astro@latest

pnpm upgrade astro --latest

yarn upgrade astro --latest

(Experimental) Prerendering pages using the Speculation Rules API

Thanks to Ross Robino, Astro’s prefetch feature now has experimental support for prerendering pages using the currently Chromium-exclusive Speculation Rules API. This API allows you to prerender pages on the client, and even run client-side JavaScript on pages that the user is likely to visit next, allowing for a faster browsing experience.

To enable this feature, add the following to your astro.config.mjs file:

import { defineConfig } from 'astro/config';

// https://astro.build/config

export default defineConfig({

prefetch: true,

experimental: {

clientPrerender: true,

},

});

This will respect your existing prefetch configuration options, but will now prerender all links with the data-astro-prefetch attribute on the client, instead. A built-in fallback is provided for browsers that do not yet support the Speculation Rules API.

Additionally, you can use the document.prerendering property in <script> tags to check whether the page is being prerendered:

<script>

if (document.prerendering) {

// prerendering is enabled

}

</script>

For more about this experimental feature, see the experimental.clientPrerender documentation.

(Experimental) Reworked routing priority for injected routes

Previously, routes injected using the injectRoute() API would be given the highest priority, meaning that they would be matched before any other routes. While this seemed like a good idea at the time, it unfortunately caused a lot of hard-to-debug issues where routes wouldn’t be matched as expected.

Historically, we’ve been hesitant to change this behavior due to how many unintended issues changes to the routing system can cause. However, thanks to Luiz Ferraz carefully implementing a fix, Astro 4.2 brings an experimental flag that lays the foundation for a new and improved default routing system in Astro!

With this flag enabled, routes injected using the injectRoute() API, as well as redirects, will now follow the same priority order that routes from the filesystem do. This should provide more stable, consisting priority ordering rules for all your project routes.

Try the future of Astro today by adding the new experimental.globalRoutePriority option to astro.config.mjs file to opt-in to the new behavior:

import { defineConfig } from 'astro/config';

// https://astro.build/config

export default defineConfig({

experimental: {

globalRoutePriority: true,

},

});

Additional logging has also been added to inform you of any route collisions where two routes are attempting to build the same URL.

Please see the experimental.globalRoutePriority documentation for more details.

New redirectToDefaultLocale config option

A common request since the introduction of internationalization support in Astro 4.0 has been the ability to disable automatic redirects of the root URL (/) to the default locale when prefixDefaultLocale: true is set.

This is now possible with the new redirectToDefaultLocale option:

import { defineConfig } from 'astro/config';

// https://astro.build/config

export default defineConfig({

i18n:{

defaultLocale: "en",

locales: ["en", "fr"],

routing: {

prefixDefaultLocale: true,

redirectToDefaultLocale: false

}

}

});

Redirect away, or don’t! It’s up to you now. This option is enabled by default.

Improved accessibility rules

The accessibility rules added to the Astro Dev Toolbar in 4.0 have been improved to be more accurate. Thanks to Oliver Speir for meticulously reading through the WCAG guidelines and improving these rules! Accessibility issues wrongfully reported as false positives by the Dev Toolbar in previous releases are fixed in this update, and more improvements are in active development.

Customizable image optimization in Markdown

Also by Oliver, remark plugins can now customize how images are optimized in Markdown files. Previously, every image included in Markdown files using the native syntax (![alt](src)) used Astro’s default settings for image optimization. With this update, remark plugins can now add properties to image nodes to customize how they are optimized.

For example, the following remark plugin will set the width and height properties of every image to 100:

import { visit } from "unist-util-visit";

export default function remarkPlugin() {

return (tree) => {

visit(tree, 'image', (node) => {

node.data.hProperties = node.data.hProperties || {};

node.data.hProperties.width = "100";

node.data.hProperties.height = "100";

});

};

}

This is currently exclusive to Markdown files, but we’re hoping to add support for MDX as well in a future release.

Bug Fixes

As always, additional bug fixes are included in this release. Check out the release notes to learn more.