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

推荐订阅源

人人都是产品经理
人人都是产品经理
MongoDB | Blog
MongoDB | Blog
Google DeepMind News
Google DeepMind News
L
LangChain Blog
J
Java Code Geeks
MyScale Blog
MyScale Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
WordPress大学
WordPress大学
小众软件
小众软件
Microsoft Security Blog
Microsoft Security Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
月光博客
月光博客
aimingoo的专栏
aimingoo的专栏
F
Fortinet All Blogs
I
InfoQ
博客园 - 聂微东
量子位
A
About on SuperTechFans
S
SegmentFault 最新的问题
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Apple Machine Learning Research
Apple Machine Learning Research
Hugging Face - Blog
Hugging Face - Blog
云风的 BLOG
云风的 BLOG
H
Help Net Security

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
Astro 4.11
Matthew Phillips · 2024-06-20 · via The Astro Blog

Astro 4.11 is out with custom 500 page improvements and Shiki transformers in the Code component.

Learn more on each of these:

  • Improvements to 500.astro
  • Shiki transfomers in the <Code /> component

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@latest

pnpm upgrade astro --latest

yarn upgrade astro --latest

Improvements to 500.astro

src/pages/500.astro is a special page file in Astro that allows you to handle 500 errors gracefully. A 500 error most commonly happens where there is a bug in your application; such as not wrapping delicate code in a try/catch. When component code throws, Astro catches and returns a 500 response. If you have src/pages/500.astro this page gets rendered into the response body.

New in 4.11, 500.astro now receives the error as a prop. This allows you to give more contextual information about the error.

---

interface Props {

error: unknown

}

const { error } = Astro.props

---

<html lang="en">

<head>

<title>Server error - Custom 500</title>

</head>

<body>

<h1>Server error</h1>

<p>{error instanceof Error ? error.message : 'Unknown error'}</p>

</body>

</html>

Shiki transfomers in the Code component

Astro’s built-in <Code /> component is used to render syntax highlighted code blocks inside of Astro pages. The component uses Shiki and supports all popular themes and languages. Now, you can also use Shiki transformers on the code blocks by passing the transformers prop:

---

import { transformerNotationFocus } from '@shikijs/transformers'

import { Code } from 'astro:components'

const code = `const foo = 'hello'

const bar = ' world'

console.log(foo + bar) // [!code focus]

`

---

<Code {code} lang="js" transformers={[transformerNotationFocus()]} />

<style is:global>

pre.has-focused .line:not(.focused) {

filter: blur(1px);

}

</style>

More

As always, Astro 4.11 includes more bug fixes and smaller improvements that couldn’t make it into this post! Check out the full release notes to learn more. Special thanks to Sarah, Bjorn, Ema, Florian, braebo and everyone else who contributed to this release.