📌 本文重点讲述各项修改的原因及效果,提供面向 AI Agent 的修改 Prompt,以便提高跨主题修改的兼容性并给予 AI 更多技术改进空间。
- 框架版本:Astro
v6.1.8- 主题及版本:astro-theme-pure ↗
v4.1.4
1. 文章链接层级简化#
为了让文章链接①看起来更精简、②更利于 SEO、③兼容 Hexo 历史文章的链接格式,我将博客文章的 URL 路由由 /blog/{id} 修改为了 /{id}。
- Astro 默认链接示例:
https://astro-pure.js.org/blog/improve-concentration - 层级简化后链接示例:
https://astro-pure.js.org/improve-concentration
以下是修改 Prompt:
# Flat Blog URLs
- **Goal**: Change blog post URLs from `/blog/{id}` to `/{id}`
- **Reason**: `astro-theme-pure` hardcodes `/blog/` prefix in `PostPreview` component with no config option to change it
## Changes
1. **Moved route file**
- From: `src/pages/blog/[...id].astro`
- To: `src/pages/[...id].astro`
- Note: `src/pages/blog/[...page].astro` (pagination list) stays at `/blog`
2. **Overrode PostPreview component**
- Created: `src/components/pages/PostPreview.astro`
- Source: Copied from `node_modules/astro-pure/components/pages/PostPreview.astro`
- Change: `href={`/blog/${id}`}` → `href={`/${id}`}`
- Fix: Changed `astro-pure/components/user` → `astro-pure/user` (correct export path)
3. **Updated imports** (4 files)
- `src/pages/index.astro`
- `src/pages/archives/index.astro`
- `src/pages/blog/[...page].astro`
- `src/pages/tags/[tag]/[...page].astro`
- All changed from `import { PostPreview } from 'astro-pure/components/pages'` to `import PostPreview from '@/components/pages/PostPreview.astro'`
4. **Updated RSS feed**
- File: `src/pages/rss.xml.ts`
- Change: `link: ` /blog/${post.id} `` → `link: `/${post.id}``
# Fix ArticleBottom Navigation Links
- **Goal**: Fix incorrect prev/next article links when using flat blog URLs (`/{id}`)
- **Reason**: `astro-pure` `ArticleBottom` component uses `Astro.url.pathname.split('/').slice(0, 2).join('/')` to calculate base path, which incorrectly includes the current post's slug (e.g., `/courses/product-management-mooc` instead of `/product-management-mooc`)
## Changes
1. **Overrode ArticleBottom component**
- Created: `src/components/pages/ArticleBottom.astro`
- Source: Copied from `node_modules/astro-pure/components/pages/ArticleBottom.astro`
- Change: `const path = Astro.url.pathname.split('/').slice(0, 2).join('/')` → `const path = Astro.url.pathname.replace(new RegExp(`/${id}/?$`), '')`
- Fix: Correctly derives base path by removing current post's ID from URL pathname
2. **Updated imports**
- File: `src/layouts/BlogPost.astro`
- Changed: `import { ArticleBottom, Copyright, Hero, TOC } from 'astro-pure/components/pages'` → `import { Copyright, Hero, TOC } from 'astro-pure/components/pages'` + `import ArticleBottom from '@/components/pages/ArticleBottom.astro'`
plaintext2. 链接末尾增加斜杠/(Cloudflare Pages 可选)#
修改背景说明:
- Astro 生成的链接末尾无斜杠
/,而 Cloudflare Pages 有强制 URL 规范化机制,如果用户访问了末尾无斜杠的链接,Cloudflare Pages 为了防止相对路径资源加载出错、搜索引擎生成重复页面,会自动发送一个 301 永久重定向,将用户引导至带斜杠的标准的目录地址:/posts/my-blog/,会略微降低网站速度。 - Waline 评论系统对 URL 敏感,链接末尾有无 / 会视为不同链接,导致同一篇文章的数据被分离到两个不同链接。
因此我在 Astro 配置文件 astro.config.ts 中设置了 trailingSlash: 'always',开启强制尾部加斜杠功能。
但开启后,本地预览时,跨页面跳转会因链接尾部不带斜杠而报错。为此,我给博客整体的内部跳转链接追加了尾部 /。
以下是修改 Prompt:
# Trailing Slash Consistency
- **Goal**: Add trailing slash `/` to all internal page links to match `trailingSlash: 'always'` config
- **Reason**: Without trailing slashes, local preview shows 404: `Your site is configured with trailingSlash set to always. Do you want to go to /sites/ instead?`
## Changes
1. **Updated navigation and footer links**
- File: `src/site.config.ts`
- Changed: 8 links — `/blog` → `/blog/`, `/message` → `/message/`, `/about` → `/about/`, `/terms` → `/terms/`, `/terms/privacy-policy` → `/terms/privacy-policy/`, `/terms/terms-and-conditions` → `/terms/terms-and-conditions/`, `/terms/copyright` → `/terms/copyright/`, `/terms/disclaimer` → `/terms/disclaimer/`
2. **Updated PostPreview component**
- File: `src/components/pages/PostPreview.astro`
- Changed: `href={`/${id}`}` → `href={`/${id}/`}`, `href={`/tags/${tag}`}` → `href={`/tags/${tag}/`}`
3. **Updated ArticleBottom component**
- File: `src/components/pages/ArticleBottom.astro`
- Changed: `href={`${path}/${prev.id}`}` → `href={`${path}/${prev.id}/`}`, `href={`${path}/${next.id}`}` → `href={`${path}/${next.id}/`}`
4. **Updated RSS feed**
- File: `src/pages/rss.xml.ts`
- Changed: `link: ` /${post.id} ``→ `link: `/${post.id}/``
5. **Updated Copyright component**
- File: `src/components/pages/Copyright.astro`
- Changed: `href='/about#sponsorship'` → `href='/about/#sponsorship'`
6. **Updated homepage**
- File: `src/pages/index.astro`
- Changed: `href={`/${p.id}`}` → `href={`/${p.id}/`}`, `href='/blog'` → `href='/blog/'`
7. **Updated blog list page**
- File: `src/pages/blog/[...page].astro`
- Changed: `href='/archives'` → `href='/archives/'`, `href={`/tags/${tag}`}` → `href={`/tags/${tag}/`}`, `href='/tags'` → `href='/tags/'`
8. **Updated tags page**
- File: `src/pages/tags/index.astro`
- Changed: `href='/blog'` → `href='/blog/'`, `href={`/tags/${tag}`}` → `href={`/tags/${tag}/`}`
9. **Updated search page**
- File: `src/pages/search/index.astro`
- Changed: `href='/blog'` → `href='/blog/'`
10. **Updated blog post layout**
- File: `src/layouts/BlogPost.astro`
- Changed: `back='/blog'` → `back='/blog/'`plaintext3. Pagefind 搜索噪音过滤(BUG修复)#
原主题未遵守 Pagefind 规范,没有标记正文内容区域,导致 Pagefind 索引了整个 <body>,搜索结果出现页眉导航和页脚版权信息,我已提交 Issue:Pagefind integration missing data-pagefind-body attribute, causing full indexing
#164 ↗,当前未修复。
以下是修改 Prompt:
# Pagefind Search Scope Fix
- **Goal**: Fix Pagefind indexing all `<body>` content instead of only article body, causing search noise from header/footer/sidebar
- **Reason**: Pagefind logs `Did not find a data-pagefind-body element on the site` and falls back to indexing entire `<body>`, including navigation, footer, and sidebar text
## Changes
1. **Added** **`data-pagefind-body`** **to ContentLayout**
- File: `src/layouts/ContentLayout.astro`
- Change: `<article class='min-w-0 grow'>` → `<article data-pagefind-body class='min-w-0 grow'>`
- Detail: Pagefind will now only index article content (title + body) on Markdown blog post pages
2. **Added** **`data-pagefind-body`** **to IndividualPage**
- File: `src/layouts/IndividualPage.astro`
- Change: `<article class='min-w-0 grow'>` → `<article data-pagefind-body class='min-w-0 grow'>`
- Detail: Pagefind will now only index article content on standalone pages (e.g., links, about)plaintext4. 文章时间逻辑修改#
我经常更新历史文章,而主题的文章排序函数取值更新日期,导致旧文章一更新:
- 在首页中会排至最前,但缩略卡片中显示发布日期(如 2026 年更新的文章却显示 2017 年的创建日期),让读者困惑,误以为博客很久未更新。
- 在归档页中,文章按更新日期所属年份归类,而非按发布日期,不合常理。
以下是修改 Prompt:
4.1 首页文章展示日期修改#
# Homepage Article Date Shows Updated Date
- **File**: `src/pages/index.astro`
- **Goal**: Show the last modified date (updatedDate) instead of publish date for articles in the homepage list
- **Change**: Updated time display logic (line 95)
- **Detail**:
- Before: `{p.data.publishDate.toISOString().split('T')[0].replace(/-/g, '/')}`
- After: `{(p.data.updatedDate ?? p.data.publishDate).toISOString().split('T')[0].replace(/-/g, '/')}`
- Uses `updatedDate` when available, falls back to `publishDate` if not set
- Consistent with `BlogPost.astro` which uses `updatedDate?.toISOString() ?? publishDate.toISOString()` for article metadataplaintext4.2 归档页文章排序逻辑修改#
# Archives Sort by Publish Date
- **File**: `src/pages/archives/index.astro`
- **Goal**: Sort and group archives by creation date (publishDate) instead of updated date
- **Reason**: Default `sortMDByDate` prioritizes `updatedDate` over `publishDate`, and `groupCollectionsByYear` uses `updatedDate ?? publishDate` for year grouping, causing posts with updates to appear in wrong year
## Changes
1. **Removed** **`sortMDByDate`** **and** **`groupCollectionsByYear`** **imports**
- Changed: `import { getBlogCollection, groupCollectionsByYear, sortMDByDate }` → `import { getBlogCollection }`
2. **Added custom sort logic**
- Replaced `sortMDByDate(allPosts)` with inline sort using only `publishDate`
- Detail: `a.data.publishDate ?? 0` ensures posts without publishDate sort to end
3. **Added custom group-by-year logic**
- Replaced `groupCollectionsByYear(allPostsByDate)` with inline reduce using only `publishDate`
- Detail: Prevents posts from being grouped by their `updatedDate` yearplaintext5. 文章置顶#

我有一篇长期维护文章「iOS 旧版 APP 推荐与降级方法(持续更新)」,为了避免其被新发布内容降低排序位置,让读者快速找到,需增加置顶功能,参考了该 Issue:新增文章置顶功能? #122 ↗。
以下是修改 Prompt:
# Article Pinning
- **Goal**: Support pinning articles to the top of blog lists
- **Reason**: [GitHub Issue #122](https://github.com/cworld1/astro-theme-pure/issues/122) — requested feature for highlighting important posts
## Changes
1. **Added** **`pin`** **field to content schema**
- File: `src/content.config.ts`
- Added: `pin: z.boolean().optional()` to blog collection schema
- Usage: Add `pin: true` to article frontmatter to pin it
2. **Created local** **`sortMDByDate`** **with pin support**
- Created: `src/utils/server.ts`
- Source: Re-exports from `astro-pure/server` except `sortMDByDate`
- Change: Pinned posts (`pin: true`) sort before non-pinned posts; within each group, sorted by date (newest first)
- Detail: `Number(bPin) - Number(aPin)` ensures pinned items appear first
3. **Updated PostPreview to show pin indicator**
- File: `src/components/pages/PostPreview.astro`
- Added: `{data.pin && <span class='text-primary mr-1'>[置顶]</span>}` before title
- Style: Uses `text-primary` color class for visual emphasis
4. **Updated imports** (7 files)
- `src/pages/index.astro`
- `src/components/home/utils.ts`
- `src/pages/blog/[...page].astro`
- `src/pages/rss.xml.ts`
- `src/pages/archives/index.astro`
- `src/pages/tags/[tag]/[...page].astro`
- `src/pages/[...id].astro`
- All changed from `import { ... } from 'astro-pure/server'` to `import { ... } from '@/utils/server'`
## Usage
Add `pin: true` to article frontmatter:
---
title: My Important Post
pin: true
---
Pinned articles will display `[置顶]` label and appear at the top of all blog lists (homepage, blog page, archives, tags, RSS).
1. **Added pin indicator to homepage**
- File: `src/pages/index.astro`
- Added: `{p.data.pin && <span class='text-primary mr-1'>[置顶]</span>}` before article title in homepage post list
- Detail: Homepage uses custom layout (not PostPreview component), so pin indicator was added separatelyplaintext6. 赞助(Sponsorship)模块移动至 About 页#
赞助模块默认放置在 Project 页,因我关闭了该分页,便将赞助模块转移至 About 页底部。
以下是修改 Prompt:
# Sponsorship Section Moved to About Page
- **Goal**: Move sponsorship/donation section from Projects page to About page bottom
- **Reason**: Sponsorship is more about the author than projects
## Changes
1. **Removed sponsorship from Projects page**
- File: `src/pages/projects/index.astro`
- Removed: `Sponsorship` and `Sponsors` component imports and usage
- Removed: `Button`, `Icon`, `alipay`, `wechat` imports (no longer needed)
- Removed: Sponsorship heading from `headings` array
- Removed: Sponsorship card hover styles
2. **Added sponsorship to About page**
- File: `src/pages/about/index.astro`
- Added: `Sponsorship` and `Sponsors` component imports
- Added: `alipay` and `wechat` image imports
- Added: `sponsorship` heading to `headings` array
- Added: Full sponsorship section (payment QR codes + sponsors list) at page bottom
3. **Updated Copyright component link**
- File: `src/components/pages/Copyright.astro`
- Change: `href='/projects#sponsorship'` → `href='/about#sponsorship'`
- Detail: Article page donation button now correctly links to About pageplaintext7. Waline 修改#
7.1 Waline 错误换行修复(BUG修复)#
因 Astro Pure CSS 错误,Waline 中被回复人的 @用户名 名称标签与回复内容不同行,我已提交 Issue:[bug] Waline reply “@username” wraps onto a new line instead of staying inline
#165 ↗,当前未修复。

以下是修改 Prompt:
# Fix Waline Reply @ Wrapping & Astro Compiler Bug
- **File**: `src/components/waline/Comment.astro`
- **Goal**: Fix the layout issue where the "@username" tag and the actual comment text in Waline replies wrapping inappropriately onto separate lines.
- **Reason**: Astro's CSS compiler fails to correctly scope/compile styles if multiple `:global()` selectors are grouped together with commas `,` (it will revert them back to scoped CSS, ignoring global directive). Thus, every selector must be declared as its own independent CSS rule block.
## Changes
1. **Created 5 Independent Global CSS Rules**
- Replaced grouped global selectors with individual, un-merged CSS declarations to bypass the Astro compiler bug:
```css
:global(#waline .wl-reply-to) {
display: inline !important;
float: none !important;
margin-right: 0.25rem !important;
}
:global(#waline .wl-reply-to a) {
display: inline !important;
}
:global(#waline .wl-reply-to ~ div) {
display: inline !important;
}
:global(#waline .wl-reply-to ~ div > p:first-child) {
display: inline !important;
margin: 0 !important;
}
:global(#waline .wl-reply-to ~ div > p:not(:first-child)) {
display: block !important;
margin-top: 0.5rem !important;
}
```
- **Detail**:
- Forces both `@username` (`.wl-reply-to`) and the first paragraph of the reply container (`p:first-child`) to render as `inline !important` to stay on the same line.
- Preserves the standard `block` layout and proper `margin-top: 0.5rem` spacing for any subsequent paragraphs inside the reply (multi-line comments).plaintext7.2 Waline 自定义 Emoji 支持第三方 CDN#
Astro Pure 主题的评论组件不支持自定义表情包链接的写法 emoji: ['tw-emoji', 'https://cdn.jsdelivr.net/gh/Druadach/bili-emoji@v1.0.1'],因此修改。
以下是修改 Prompt:
# Waline Emoji CDN Support
- **File**: `src/components/waline/Comment.astro`
- **Goal**: Support both preset names and full CDN URLs for emoji packs
- **Change**: Updated emoji processing logic (line 41-45)
- **Detail**:
- Added URL detection: if preset starts with `http`, use it directly
- Otherwise, prepend `${npmCDN}/@waline/emojis@1.2.0/` as before
- Enables using third-party emoji packs like `https://cdn.jsdelivr.net/gh/Druadach/bili-emoji@v1.0.1`
- Fixed TypeScript type error: moved `as WalineEmojiPresets` cast to wrap entire ternary expressionplaintext7.3 去除文章反应的暗色滤镜#
Astro Pure 主题默认给文章反应的图片加了层变暗 25% 的滤镜,因此若自定义了文章反应图片,显示效果将不符预期。
若使用主题默认的 ♡ 符号则无需修改。
以下是修改 Prompt:
# Remove Waline Reaction Image Invert Filter
- **File**: `src/components/waline/Comment.astro`
- **Goal**: Remove CSS `filter: invert()` on reaction images that caused them to appear black
- **Change**: Deleted two CSS rules (light mode `invert(25%)` and dark mode `invert(75%)`)
- **Detail**:
- Removed `#waline :global(.wl-reaction img) { filter: invert(25%); }`
- Removed `:global(.dark) #waline :global(.wl-reaction img) { filter: invert(75%); }`
- Reaction images now display their original colorsplaintext8. 移动端表格横向滚动修复(BUG修复)#
因 UnoCSS 的预设属性错误,当表格内容溢出手机屏幕后,无法左右滑动表格查看,我已提交 Issue:[bug] Tables in blog posts do not scroll horizontally on mobile devices #166 ↗,当前未修复。
以下是修改 Prompt:
# Mobile Table Horizontal Scrolling Fix
- **Goal**: Enable horizontal scrolling for tables on mobile devices when content overflows
- **Problem**: Tables had `display: block` in UnoCSS typography config, which prevented horizontal scrolling on narrow screens
## Changes
1. **Updated table style in UnoCSS config**
- File: `uno.config.ts`
- Line: 105
- Changed: `table: { display: 'block', 'font-size': '.875em' }` → `table: { display: 'block', 'font-size': '.875em', 'overflow-x': 'auto' }`
- Detail: Added `overflow-x: auto` to allow horizontal scrollbar when table width exceeds container width
## Usage
Tables in blog posts will now display a horizontal scrollbar on mobile devices when their content is wider than the screen. Users can swipe left/right to view the full table content.plaintext9. 移除外部英文字体#
Astro 从外部加载 Satoshi 作为默认的英文字体,对于中文内容为主的博客来说可精简,以提高网站性能。
以下是修改 Prompt:
# Remove Satoshi Font
- **Goal**: Remove Satoshi font (loaded via Astro Font API from Fontshare) as it is not needed
- **Reason**: Satoshi was used as the global body font but is unnecessary; the site will fall back to system default sans-serif fonts
## Changes
1. **Removed font configuration**
- File: `astro.config.ts`
- Removed: `fonts` array containing Satoshi font definition (provider, name, cssVariable, styles, weights, subsets)
- Removed: `fontProviders` from `astro/config` import (no longer used)
2. **Removed Font component and body style**
- File: `src/components/BaseHead.astro`
- Removed: `import { Font } from 'astro:assets'`
- Removed: `<Font cssVariable='--font-satoshi' preload={[{ subset: 'latin', style: 'normal' }]} />`
- Removed: `<style> body { font-family: var(--font-satoshi); } </style>`
- Note: Caveat font preload `<link>` is preservedplaintext10. 增加 Vercount 站点计数#
为了统计网站访问量,我本想使用 busuanzi ↗,但在 Astro 中存在重复统计数据问题:载入一次网页记录多次 PV。
故改用 Vercount ↗ 并在首页配置了站点统计卡片以展示数据。

BUG:Vercount 在较老浏览器中,如 iOS 15.4 的 Safari 上无法加载数据,我特别做了兜底修复。
以下是修改 Prompt:
# Homepage Site Statistics (Vercount)
- **Goal**: Add a site statistics card to the homepage showing article count, word count, site age, PV, and UV, inspired by `catcodeme.github.io-astro-pure-v4_0_3`
## Changes
1. **Created utility functions**
- Created: `src/components/home/utils.ts`
- Contains:
- `calculateSiteAge(startDate)` — computes site age from a given start date, returns formatted string like `9 年 4 个月`
- `getLatestPosts(limit)` — fetches latest blog posts sorted by date
- `getTotalWords()` — counts total Chinese characters + English words across all posts
2. **Added Vercount script**
- File: `src/layouts/BaseLayout.astro`
- Change: Added the following script before `</body>`:
```html
<script is:inline>
window.addEventListener('load', () => {
if ('requestIdleCallback' in window) {
requestIdleCallback(() => {
const script = document.createElement('script');
script.src = 'https://events.vercount.one/js';
script.async = true;
document.body.appendChild(script);
});
}
});
</script>
```
- Detail: Vercount is a lightweight site analytics service that auto-fills elements with matching IDs
3. **Updated homepage**
- File: `src/pages/index.astro`
- Added imports: `calculateSiteAge`, `getTotalWords` from `@/components/home/utils`
- Added "Site Stats" section between "About" and "Posts" using receipt-style (dashed border) card design
- Displays: Articles, Words, UpTime, ∑ PV (`id='vercount_value_site_pv'`), ∑ UV (`id='vercount_value_site_uv'`)
- PV/UV values are loaded client-side by Vercount script; show "Loading" until populated
- Site start date defaults to `2017-01-01` (adjustable in `calculateSiteAge()` call)
4. **Vercount Safari Compatibility Fix**
- File: `src/layouts/BaseLayout.astro`
- Goal: Fix PV/UV statistics not loading on Safari <17.4 (e.g., iOS Safari 15.4)
- Reason: `requestIdleCallback` API is not supported in Safari until version 17.4; the original code's `if ('requestIdleCallback' in window)` check evaluates to `false` on older Safari, causing the Vercount script to never load
- Change: Added `setTimeout` fallback when `requestIdleCallback` is unavailable
- Detail:
- Extracted Vercount script loading into a `loadVercount` function
- Browsers with `requestIdleCallback` support continue to use it for idle-time loading
- Browsers without support (Safari <17.4) fall back to `setTimeout(loadVercount, 1)`
- Ensures Vercount script loads on all browsers while preserving performance optimization on supported onesplaintext11. Google Analytics 轻量版#
为了分析流量数据,博客引入了 Google Analytics,但官方脚本非常臃肿,高达 275.7 KB 且无法精简,脚本的大部分功能在个人博客上并未使用,拖慢页面加载速度。

为此,改用极其轻量、大小仅 8.8 KB 的第三方脚本 GA4MP ↗。
以下是修改 Prompt:
# Google Analytics via ga4mp (Lazy Load)
- **File**: `src/layouts/BaseLayout.astro`
- **Goal**: Add Google Analytics with minimal Lighthouse performance impact
- **Reason**: Third-party analytics scripts block rendering and increase TBT; lazy loading after page idle minimizes the impact
## Changes
1. **Added Google Analytics (via ga4mp)**
- ID: `G-1KNCP99MXT`
- Library: `@analytics-debugger/ga4mp@0.0.8` (open-source GA4 Measurement Protocol, <4kb compressed, 95.6% lighter than gtag.js)
- Script: `https://cdn.jsdelivr.net/npm/@analytics-debugger/ga4mp@0.0.8/dist/ga4mp.umd.min.js`
- Strategy: `requestIdleCallback` (preferred) / `setTimeout(..., 500)` (fallback)
- Sends `page_view` event via `ga4track.trackEvent('page_view')` after script loads
- Uses `non_personalized_ads: true` for privacy compliance
2. **Loading priority**
- Vercount → Google Analyticsplaintext12. 本地预览防数据污染#
为防止 Waline 文章浏览量统计、vercount 访问量统计、Google Analytics 流量统计在本地调试时因频繁刷新页面导致数据虚高,我增加了本地开发环境过滤。
以下是修改 Prompt:
# Localhost exclusion
- **Files**: `src/layouts/BaseLayout.astro`, `src/components/waline/Pageview.astro`, `src/components/waline/Comment.astro`
- **Change**:
- `BaseLayout.astro`: Added `if (location.hostname === 'localhost' || location.hostname === '127.0.0.1') return;` guard before loading Vercount and Google Analytics
- `Pageview.astro`: Added same guard before loading Waline pageview count
- `Comment.astro`: Added `pageview: location.hostname !== 'localhost' && location.hostname !== '127.0.0.1'` after `...walineConfig.additionalConfigs` spread to override `pageview: true` from config
- **Detail**: Waline pageview has two entry points — standalone `Pageview.astro` script and `walineInit` in `Comment.astro` (which reads `pageview: true` from `additionalConfigs`). The `pageview` key must be placed **after** the spread to avoid being overridden by `additionalConfigs.pageview: true`plaintext13. 国内 DNS 加速(仅 Cloudflare Pages 需要)#
因博客访问量太大,我选择托管在不限流量的 Cloudflare Pages 上,但域名解析也被迫转交给了 Cloudflare,国内访客被分配到延迟高的美国节点。
我参考了这篇教程的 Worker 路由反代方案(日请求量需<10万),成功把延迟从 180ms 降低到了 90ms 左右:试试Cloudflare IP优选!让Cloudflare在国内再也不是减速器! ↗。

14. 修复旧版浏览器丢失文章样式问题(可选)#
因 UnoCSS 的这个问题:CSS Nesting syntax introduced in unocss@66.5 preset-typography breaks compatibility with older browsers #4971 ↗。
在不支持 CSS 原生嵌套的较老浏览器上,无法解析 UnoCSS 生成的嵌套 CSS 导致文章丢失样式。

以下是修改 Prompt:
# Fix Safari 15.4 Prose Styles (LightningCSS)
- **Goal**: Fix article content losing all typography styles on Safari 15.4 (mobile)
- **Reason**: UnoCSS v66.5+ `preset-typography` generates native CSS nesting syntax, which Safari 15.4 does not support. This causes all `.prose` rules (headings, paragraphs, lists, blockquotes, etc.) to be silently ignored. See [unocss/unocss#4971](https://github.com/unocss/unocss/issues/4971)
- **TODO**: Once UnoCSS merges [#5062](https://github.com/unocss/unocss/pull/5062) (adds `compatibility.nestable: false` option) or releases a fix, consider removing this workaround and using the upstream solution instead
## Changes
1. **Added LightningCSS transformer**
- File: `astro.config.ts`
- Change: Added `vite: { css: { transformer: 'lightningcss' } }` to `defineConfig`
- Effect: Vite uses LightningCSS to flatten nested CSS output from UnoCSS into flat selectors, compatible with older browsers
2. **Installed `lightningcss` dependency**
- Command: `npm install lightningcss --legacy-peer-deps`plaintext