使用 Hugo 和 Blowfish 构建的个人博客。
当前固定版本:
- Hugo Extended 0.163.3
- Blowfish 2.104.0
cd ~/blog
hugo server --buildDrafts浏览器打开 http://localhost:1313/。
cd ~/blog
hugo new content posts/my-post/index.md编辑生成的 Markdown 文件。文章准备发布时,将 Front Matter 中的
draft 改为 false。
cd ~/blog
hugo --gc --minify生成结果位于 public/,该目录不会提交到 Git。
当前 GitHub 用户为 mon3stera,Pages 用户站点对应的仓库必须命名为
mon3stera.github.io。
在本地创建公开仓库并推送现有提交:
cd ~/blog
gh repo create mon3stera.github.io --public --source=. --remote=origin --push然后完成以下设置:
- 打开 https://github.com/mon3stera/mon3stera.github.io/settings/pages。
- 在 Build and deployment 下,将 Source 设置为 GitHub Actions。
- 打开仓库的 Actions 页面。
- 如果首次工作流在启用 Pages 前已经运行并失败,选择该工作流并点击 Re-run all jobs。
- 工作流成功后访问 https://mon3stera.github.io/。
git add .
git commit -m "content: add a new post"
git push每次推送到 main,GitHub Actions 都会自动重新构建并部署网站。
hugo mod get -u github.com/nunocoracao/blowfish/v2
hugo mod tidy
hugo --gc --minify只有在生产构建成功后,才提交更新后的 go.mod 和 go.sum。