mon3stera/mon3stera.github.io

★ 0Forks 0GitHub ↗Compare

README

Mon3stera Blog

使用 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 Pages

当前 GitHub 用户为 mon3stera,Pages 用户站点对应的仓库必须命名为 mon3stera.github.io。

在本地创建公开仓库并推送现有提交:

cd ~/blog
gh repo create mon3stera.github.io --public --source=. --remote=origin --push

然后完成以下设置:

  1. 打开 https://github.com/mon3stera/mon3stera.github.io/settings/pages。
  2. 在 Build and deployment 下,将 Source 设置为 GitHub Actions。
  3. 打开仓库的 Actions 页面。
  4. 如果首次工作流在启用 Pages 前已经运行并失败,选择该工作流并点击 Re-run all jobs。
  5. 工作流成功后访问 https://mon3stera.github.io/。

发布后续修改

git add .
git commit -m "content: add a new post"
git push

每次推送到 main,GitHub Actions 都会自动重新构建并部署网站。

更新 Blowfish

hugo mod get -u github.com/nunocoracao/blowfish/v2
hugo mod tidy
hugo --gc --minify

只有在生产构建成功后,才提交更新后的 go.mod 和 go.sum。

Contributors

mon3stera

Issues