# Astro 静态 SEO 站点 — 上下文包

> 一个可复制的上下文包，描述了 Astro 静态 SEO 站点，以便 AI 代理从第一个提示开始就能正确地在其中工作。

**Type:** Context Pack  
**Tools:** Cursor, Claude Code, Codex  
**Stack:** Astro, Tailwind, TypeScript  
**Updated:** 2026-06-08

---

将此内容粘贴到任务的顶部，以便代理在编写任何内容之前了解项目。它既可供人类阅读，也可供您的代理阅读。

## 项目背景

```txt
A content-driven static site built with Astro. No database, no server runtime.
Content lives in Markdown/MDX under src/content and is rendered to static HTML
at build time. Deployed to Cloudflare Pages.
```

## 技术栈

```txt
Astro 6 (static output)
MDX content collections (Content Layer API)
Tailwind CSS v4 (via @tailwindcss/vite)
Pagefind for static search
TypeScript (strict)
```

## 目录结构

```txt
src/content/        # MDX content, one folder per collection
src/content.config.ts
src/layouts/        # BaseLayout, ResourceLayout
src/pages/          # routes + .md/.json endpoints + llms.txt
src/components/
```

## 编码规范

```txt
- Content is data: edits to copy should be MDX edits, not template changes.
- Keep components in plain Astro; add a framework island only when needed.
- Every resource page also emits a .md and .json version.
- No client-side rendering of primary content — output HTML at build time.
```

## AI 任务边界

```txt
- Do not add a server adapter or database.
- Do not break the .md/.json/llms.txt endpoints.
- Validate frontmatter against the zod schema in content.config.ts.
```

## llms.txt

```txt
This site publishes /llms.txt and a .md version of every page so agents can
read content as clean Markdown instead of scraping HTML.
```