- README.md 顶部加'简体中文 | English'切换 header - 半角逗号/冒号/括号统一改回中文全角(原文里被替成半角是误操作) - 新增 README.en.md:精简版,只留 hugo 起步 + 部署链路,适合外部读者 CI 触发提示:.gitea/workflows/build.yml paths-ignore 只列了 README.md, README.en.md 不在内,本次 push 会触发一次 build+deploy。改 yml 再加是 另一笔的事,本 commit 不动。
This commit is contained in:
@@ -0,0 +1,45 @@
|
|||||||
|
# Zhengchen's Notebook
|
||||||
|
|
||||||
|
[简体中文](README.md) | English
|
||||||
|
|
||||||
|
Personal blog source, built on [Hugo](https://gohugo.io/) + [hugo-theme-stack](https://github.com/CaiJimmy/hugo-theme-stack).
|
||||||
|
|
||||||
|
Live at <https://blog.zhengchentao.win/>.
|
||||||
|
|
||||||
|
## Local development
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# First-time clone: pull submodules
|
||||||
|
git clone --recurse-submodules <repo>
|
||||||
|
# Or, if already cloned:
|
||||||
|
git submodule update --init --recursive
|
||||||
|
|
||||||
|
# Local preview (includes drafts)
|
||||||
|
hugo server -D
|
||||||
|
|
||||||
|
# Production build
|
||||||
|
hugo --gc --minify
|
||||||
|
```
|
||||||
|
|
||||||
|
Requires Hugo Extended ≥ 0.161.1.
|
||||||
|
|
||||||
|
## New post
|
||||||
|
|
||||||
|
```bash
|
||||||
|
hugo new posts/2026-05-06-my-post.md
|
||||||
|
```
|
||||||
|
|
||||||
|
The date in the filename is only for local sorting — the actual publish time
|
||||||
|
comes from the `date` field in front matter.
|
||||||
|
|
||||||
|
## Deployment
|
||||||
|
|
||||||
|
Push-to-deploy via Gitea Actions: every push to `main` triggers a build, then
|
||||||
|
`rsync` ships `public/` to a directory bind-mounted into a long-running nginx
|
||||||
|
container on the NAS. Filesystem-level sync, no restart needed. Compose file
|
||||||
|
for the nginx container lives at [deploy/docker-compose.yml](deploy/docker-compose.yml).
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
* Post content: [CC BY-NC-SA 4.0](https://creativecommons.org/licenses/by-nc-sa/4.0/)
|
||||||
|
* Theme: see `themes/stack/` for its own license
|
||||||
@@ -1,14 +1,16 @@
|
|||||||
# 陶政辰的笔记本
|
# 陶政辰的笔记本
|
||||||
|
|
||||||
个人博客源码,基于 [Hugo](https://gohugo.io/) + [hugo-theme-stack](https://github.com/CaiJimmy/hugo-theme-stack)。
|
简体中文 | [English](README.en.md)
|
||||||
|
|
||||||
线上地址:<https://blog.zhengchentao.win/>
|
个人博客源码,基于 [Hugo](https://gohugo.io/) + [hugo-theme-stack](https://github.com/CaiJimmy/hugo-theme-stack)。
|
||||||
|
|
||||||
|
线上地址:<https://blog.zhengchentao.win/>
|
||||||
|
|
||||||
## 目录结构
|
## 目录结构
|
||||||
|
|
||||||
```
|
```
|
||||||
.
|
.
|
||||||
├── .gitea/workflows/ # Gitea Actions:push 后自动 build + rsync 到 NAS
|
├── .gitea/workflows/ # Gitea Actions:push 后自动 build + rsync 到 NAS
|
||||||
├── archetypes/ # 新文章模板
|
├── archetypes/ # 新文章模板
|
||||||
├── assets/ # 自定义 SCSS / 图片
|
├── assets/ # 自定义 SCSS / 图片
|
||||||
├── content/ # 正文
|
├── content/ # 正文
|
||||||
@@ -16,8 +18,8 @@
|
|||||||
│ ├── archives/ # 归档页
|
│ ├── archives/ # 归档页
|
||||||
│ ├── posts/ # 文章
|
│ ├── posts/ # 文章
|
||||||
│ └── search/ # 搜索页
|
│ └── search/ # 搜索页
|
||||||
├── deploy/ # NAS 上 nginx 容器的 docker-compose(参考用)
|
├── deploy/ # NAS 上 nginx 容器的 docker-compose(参考用)
|
||||||
├── themes/stack/ # 主题(git submodule)
|
├── themes/stack/ # 主题(git submodule)
|
||||||
└── hugo.yaml # Hugo 配置
|
└── hugo.yaml # Hugo 配置
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -26,10 +28,10 @@
|
|||||||
```bash
|
```bash
|
||||||
# 第一次拉代码记得带上 submodule
|
# 第一次拉代码记得带上 submodule
|
||||||
git clone --recurse-submodules <repo>
|
git clone --recurse-submodules <repo>
|
||||||
# 或:已经 clone 了
|
# 或:已经 clone 了
|
||||||
git submodule update --init --recursive
|
git submodule update --init --recursive
|
||||||
|
|
||||||
# 本地预览(含草稿)
|
# 本地预览(含草稿)
|
||||||
hugo server -D
|
hugo server -D
|
||||||
|
|
||||||
# 生产构建
|
# 生产构建
|
||||||
@@ -44,20 +46,20 @@ hugo --gc --minify
|
|||||||
hugo new posts/2026-05-06-my-post.md
|
hugo new posts/2026-05-06-my-post.md
|
||||||
```
|
```
|
||||||
|
|
||||||
文件名里的日期只是给自己排序用,真正决定发布时间的是 front matter 里的 `date`。
|
文件名里的日期只是给自己排序用,真正决定发布时间的是 front matter 里的 `date`。
|
||||||
|
|
||||||
## 部署
|
## 部署
|
||||||
|
|
||||||
不用手动部署。流程:
|
不用手动部署。流程:
|
||||||
|
|
||||||
1. `git push` 到 `main`
|
1. `git push` 到 `main`
|
||||||
2. Gitea Actions(`.gitea/workflows/build.yml`)在 runner 里跑 `hugo --gc --minify`
|
2. Gitea Actions(`.gitea/workflows/build.yml`)在 runner 里跑 `hugo --gc --minify`
|
||||||
3. `rsync` 把 `public/` 推到 NAS 上的 `/blog-public/`(host 模式 bind mount)
|
3. `rsync` 把 `public/` 推到 NAS 上的 `/blog-public/`(host 模式 bind mount)
|
||||||
4. NAS 上常驻的 nginx 容器只读挂载该目录,文件系统层同步,无需重启
|
4. NAS 上常驻的 nginx 容器只读挂载该目录,文件系统层同步,无需重启
|
||||||
|
|
||||||
NAS 上 nginx 容器的 compose 文件见 [deploy/docker-compose.yml](deploy/docker-compose.yml),只在重建时用得到。
|
NAS 上 nginx 容器的 compose 文件见 [deploy/docker-compose.yml](deploy/docker-compose.yml),只在重建时用得到。
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
* 文章内容:[CC BY-NC-SA 4.0](https://creativecommons.org/licenses/by-nc-sa/4.0/deed.zh)
|
* 文章内容:[CC BY-NC-SA 4.0](https://creativecommons.org/licenses/by-nc-sa/4.0/deed.zh)
|
||||||
* 主题:见 `themes/stack/` 自身 license
|
* 主题:见 `themes/stack/` 自身 license
|
||||||
|
|||||||
Reference in New Issue
Block a user