-
写作:在
content/posts/
下新建 Markdown,如2025-xx-new-post.md
,文件头内需要包含如下内容。当draft
为true
时,对应的页面会被隐藏,除非hugo server启动时添加了-D
参数(见后文)。-
--- title: "Hello World" date: 2025-10-20 draft: false tags: ["intro"] author: "Patrick" ---
-
-
预览:本地可装 Hugo 预览(配置方法见后文);不会本地跑的同学直接提 PR 也行。
-
发布:合并到
main
自动上线(GitHub Actions 构建部署)。 -
格式提示
- 可以直接在markdown中使用latex。
- 行内公式建议使用
\(a_1\)
而不是$a_1$
,后者易和正常的美元符混淆,容易产生问题。
# 基本环境配置
## 安装hugo
brew install hugo
## 确认hugo版本
hugo version # 需要输出类似v0.151.2+extended字样,版本号不应更低,且包含extended字样
## 检出代码
git clone https://github.com/<your-username>/AIM-blog.git
cd AIM-blog
## 初始化
hugo mod clean
hugo mod get -u
hugo mod vendor
## 启动本地预览,此时可以通过访问http://localhost:1313/来访问网页
hugo server -D --ignoreCache --disableFastRender # 在server启动的情况下,Markdown, config, templates发生更改时会自动刷新