目录结构
Snow 站点的标准文件布局:
1mysite/ 2├── config.yaml # 站点配置 3├── content/ # 内容目录(固定名) 4│ ├── _index.md # 根 Section 5│ ├── about.md # Page 6│ └── posts/ # Section 7│ ├── _index.md # Section 内容 8│ ├── hello.md # Page 9│ └── tutorials/ # 子 Section 10│ └── _index.md 11├── static/ # 静态文件(固定名,原样复制到输出) 12├── templates/ # 站点自定义模板(覆盖主题模板) 13├── themes/ # 主题目录(固定名) 14│ └── snow/ # 主题名称 = theme 15│ ├── theme.yaml 16│ ├── templates/ 17│ ├── static/ 18│ └── i18n/ 19├── assets/ # 需启用 hooks.assets 20│ ├── js/ 21│ ├── css/ 22│ └── scss/ 23└── i18n/ # 翻译文件 24 ├── en.yaml 25 └── zh.yaml
固定目录
| 目录 | 说明 |
|---|---|
content/ |
内容目录 |
static/ |
静态文件目录,原样复制到输出 |
templates/ |
站点模板目录,优先于主题模板 |
themes/ |
主题目录,theme 对应 themes/{name}/ |
assets/ |
assets hook 默认读取的资源目录 |
data/ |
data 模板扩展默认读取的数据目录 |
i18n/ |
i18n 模板扩展默认读取的翻译目录 |
output/ |
默认构建输出目录,可通过 output_dir 修改 |
核心目录 content、static、templates、themes 使用固定名称;扩展目录(如 assets、data、i18n)由各扩展按需读取。
如果需要把站点外部的文件或目录接入构建流程,可以使用 mount hook。
内容目录详解
识别规则
| 文件/目录 | 识别为 |
|---|---|
*.md / *.org / *.html |
Page |
_index.{md,org,html} |
Section 标记 |
index.{md,org,html} |
Page Bundle 标记 |
_* / .* 开头 |
默认忽略 |
支持的内容扩展名、启用方式和解析细节见 解析器。
Page
普通文件(.md、.org、.html)即为 Page。输出路径由 pages.{type}.path 决定。
Section
包含 _index.* 的目录为 Section。Section 可嵌套形成层级结构。
Page Bundle
包含 index.{md,org,html} 的目录视为一个页面整体,目录内其他文件为附属资源。
忽略规则
- 以
_或.开头的文件/目录(_index.*除外) ignored_content匹配的内容
1ignored_content: 2 - "drafts/" 3 - "private/*"