|
1 | 1 | # CLAUDE.md |
2 | 2 |
|
3 | | -This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. |
| 3 | +本文件为 Claude Code (claude.ai/code) 在此仓库中工作提供指导。 |
4 | 4 |
|
5 | | -## Project Overview |
| 5 | +**重要说明:本项目的所有文档、注释和生成内容都应使用中文。** |
6 | 6 |
|
7 | | -This is a Hugo-based personal blog (夜航星 / Night Voyager) using the FixIt theme. The site is in Chinese (zh-CN) and covers topics like cognitive psychology, learning methods, data analysis, and programming. |
| 7 | +## 项目概述 |
8 | 8 |
|
9 | | -- **Base URL:** https://austinxt.github.io (Custom domain: blog.nightvoyager.top) |
10 | | -- **Theme:** FixIt (installed as git submodule in `themes/FixIt/`) |
| 9 | +这是一个基于 Hugo 的个人博客(夜航星 / Night Voyager),使用 FixIt 主题。网站语言为中文(zh-CN),内容涵盖认知心理学、学习方法、数据分析和编程等主题。 |
11 | 10 |
|
12 | | -## Common Commands |
| 11 | +- **基础 URL:** https://austinxt.github.io(自定义域名:blog.nightvoyager.top) |
| 12 | +- **主题:** FixIt(作为 git 子模块安装在 `themes/FixIt/` 目录) |
| 13 | +- **Hugo 版本:** 0.154.5 extended(在 `.github/workflows/hugo.yml` 中指定) |
| 14 | + |
| 15 | +## 常用命令 |
13 | 16 |
|
14 | 17 | ```bash |
15 | | -# Development server with live reload |
| 18 | +# 开发服务器(支持热重载) |
16 | 19 | hugo server |
17 | 20 |
|
18 | | -# Development with full rebuild on changes (use when editing layouts) |
| 21 | +# 开发服务器(编辑布局文件时使用,完整重建) |
19 | 22 | hugo server --disableFastRender |
20 | 23 |
|
21 | | -# Production build (outputs to public/) |
| 24 | +# 生产环境构建(输出到 public/ 目录) |
22 | 25 | hugo |
23 | 26 |
|
24 | | -# Create new post |
| 27 | +# 创建新文章 |
25 | 28 | hugo new posts/YYYY-MM-DD-title.md |
26 | 29 |
|
27 | | -# Create new talk/note |
| 30 | +# 创建新笔记/讨论 |
28 | 31 | hugo new talks/YYYY-MM-DD-title.md |
29 | 32 | ``` |
30 | 33 |
|
31 | | -## Architecture |
| 34 | +## 项目架构 |
32 | 35 |
|
33 | | -### Content Organization |
34 | | -- `content/posts/` - Published articles (~70 posts) |
35 | | -- `content/talks/` - Discussion notes and quick thoughts (~43 entries) |
36 | | -- `content/draft/` - Draft articles (not published) |
| 36 | +### 内容组织 |
| 37 | +- `content/posts/` - 已发布文章(约 70 篇) |
| 38 | +- `content/talks/` - 讨论笔记和随想(约 43 篇) |
| 39 | +- `content/draft/` - 草稿文章(未发布) |
37 | 40 |
|
38 | | -### Configuration |
39 | | -- `config.toml` - Main Hugo configuration including SEO verification codes, menu structure, theme settings, and markup options |
| 41 | +### 配置文件 |
| 42 | +- `config.toml` - Hugo 主配置文件,包含 SEO 验证码、菜单结构、主题设置、Giscus 评论、Fuse 搜索和标记选项 |
40 | 43 |
|
41 | | -### Custom Layouts |
42 | | -- `layouts/_partials/head/seo.html` - Enhanced SEO metadata template with JSON-LD schema, AI-friendly tags, and search engine verification codes |
| 44 | +### 自定义布局 |
| 45 | +- `layouts/_partials/head/seo.html` - 增强的 SEO 元数据模板,包含 JSON-LD schema、AI 友好标签和搜索引擎验证码 |
| 46 | +- `layouts/partials/head/custom.html` - 自定义 head 内容 |
| 47 | +- `layouts/partials/audio-player.html` - 音频播放器组件(在 `params.customPartials.postContentBefore` 中配置) |
43 | 48 |
|
44 | | -### Static Assets |
45 | | -- `static/robots.txt` - SEO crawler rules including explicit AI crawler permissions (GPTBot, Claude-Web, etc.) |
46 | | -- `static/ai.txt` - AI usage policy declaration (CC-BY-NC-4.0 license) |
47 | | -- `static/CNAME` - GitHub Pages custom domain configuration |
| 49 | +### 静态资源 |
| 50 | +- `static/robots.txt` - SEO 爬虫规则,包含对 AI 爬虫的明确授权(GPTBot、Claude-Web 等) |
| 51 | +- `static/ai.txt` - AI 使用政策声明(CC-BY-NC-4.0 许可证) |
| 52 | +- `static/CNAME` - GitHub Pages 自定义域名配置 |
48 | 53 |
|
49 | | -### Theme |
50 | | -The FixIt theme is a git submodule. Do not modify files inside `themes/FixIt/` directly. Use `layouts/` directory for customizations that override theme templates. |
| 54 | +### 主题 |
| 55 | +FixIt 主题作为 git 子模块安装。请勿直接修改 `themes/FixIt/` 目录下的文件。如需自定义,请在 `layouts/` 目录中创建覆盖模板。 |
51 | 56 |
|
52 | | -## Front Matter Template |
| 57 | +## Front Matter 模板 |
53 | 58 |
|
54 | | -Posts use YAML front matter with these key fields: |
| 59 | +文章使用 YAML 格式的 front matter,主要字段如下: |
55 | 60 | ```yaml |
56 | | -title: Post title |
57 | | -subtitle: Subtitle |
| 61 | +title: 文章标题 |
| 62 | +subtitle: 副标题 |
58 | 63 | date: YYYY-MM-DD |
59 | | -description: SEO description |
60 | | -tags: [tag1, tag2] |
61 | | -categories: [category] |
| 64 | +description: SEO 描述 |
| 65 | +tags: [标签1, 标签2] |
| 66 | +categories: [分类] |
62 | 67 | featuredImage: /images/image.jpg |
63 | 68 | lightgallery: true |
64 | | -mathjax: false # Enable per-post for math content |
65 | 69 | ``` |
66 | 70 |
|
67 | | -## Deployment |
| 71 | +## 部署 |
| 72 | +
|
| 73 | +网站使用 GitHub Actions 自动部署。推送到 `main` 分支会触发: |
| 74 | +1. 使用 `--gc --minify` 参数构建 Hugo |
| 75 | +2. 上传到 GitHub Pages |
68 | 76 |
|
69 | | -The site deploys to GitHub Pages. After running `hugo`, commit the `public/` directory and push to trigger deployment. |
| 77 | +详见 `.github/workflows/hugo.yml` 工作流配置。无需手动部署。 |
0 commit comments