Skip to content

Project Structure.zh

FlowerCA77 edited this page Sep 21, 2025 · 2 revisions

项目结构

英文版:Project Structure (EN).

该项目遵循 Astro 5 约定,配合 Tailwind 4 与可选的 React 组件。

.
├─ public/                    # 静态资源(原样复制)
├─ src/
│  ├─ assets/                 # 站点使用的资源
│  ├─ components/             # 可复用组件(Astro/TSX)
│  ├─ layouts/                # 页面布局
│  ├─ pages/                  # 基于文件的路由
│  ├─ styles/                 # 全局样式(Tailwind 入口等)
│  ├─ content/                # 站点内容(Markdown/MDX)
│  └─ content.config.ts       # Astro 内容集合配置
├─ astro.config.mjs           # Astro 配置
├─ tailwind.config.js         # Tailwind 配置
├─ tsconfig.json              # TS 配置(继承 Astro strict)
├─ package.json               # 脚本与依赖(PNPM)
└─ pnpm-lock.yaml             # PNPM 锁文件

关键文件:

  • astro.config.mjs:站点 URL、集成(React、MDX)、Vite 插件(Tailwind)、Markdown 处理(remark-math、rehype-katex、rehype-slug)、Shiki 主题。
  • tailwind.config.js:扫描范围、class 模式的暗色主题、基于 CSS 变量的颜色令牌。
  • src/content.config.ts:四类内容集合(articlesnewsannouncementsauthors)及其 Zod 校验。
  • src/pages/:路由文件,包含动态路由 [param].astro 与兜底 [...param].astro

相关:内容集合路由.

目录结构示意图

flowchart TD
	A[仓库根目录] --> B[public/]
	A --> C[src/]
	C --> C1[assets/]
	C --> C2[components/]
	C --> C3[layouts/]
	C --> C4[pages/]
	C --> C5[styles/]
	C --> C6[content/]
	C --> C7[content.config.ts]
	A --> D[astro.config.mjs]
	A --> E[tailwind.config.js]
	A --> F[tsconfig.json]
	A --> G[package.json]
	A --> H[pnpm-lock.yaml]
Loading

Clone this wiki locally