向github pages推送hugo文档
从Hexo迁移到Hugo之后,需要本地改完推到github上,通过CI自动构建(Action)部署,整个部署过程大约需要2分钟。
修改文件
cd mixiang.tech
# —— 日常流程:改文件 → 提交 → 推送 ——
git add -A # 或 git add <具体文件>
git commit -m "描述这次改了什么"
git push # CI 自动触发构建部署如果遇到git push超时,可能是网络暂时不通,过几分钟后可以再
git push一次。
新增文章
# 通过hugo 创建一个新文件
hugo new content posts/my-post.md # 生成带 front matter 的草稿
# 编辑 content/posts/my-post.md,front matter 含 draft: true 时不发布
# 正式发布:把 draft 改成 false(或删除该行),设置日期
hugo server -D # 本地预览 http://localhost:1313 (-D 含草稿)
# 满意后:
git add content/posts/my-post.md && git commit -m "发布新文章: <标题>" && git push- 改主题样式(assets/css/_custom.scss)或 模板(layouts/_partials/)同样流程,注意本地 hugo server 会热更新
- 不要修改 themes/LoveIt 子模块内部,通常主题都会提供注入机制;不要直接改 github.io pages(它是 CI 的输出端,手动改会被下次部署覆盖)
- github CI 状态,在https://github.com/username/repo/actions看 ,构建完成以后,大约 1-2 分钟 Pages完成更新。


