日常更新文章(推荐流程)
1. 进入博客目录
cd x:\A_CODE\z_ayanamiBlog\blog
2. (可选)本地预览,确认排版没问题
npm run server
浏览器打开 http://localhost:4000 ,看完 Ctrl+C 停掉
3. 提交并推送(GitHub 会自动 hexo build + 发布)
git add source/_posts/
git commit -m "post: 更新 xxx 文章"
git push origin master
推送后去 GitHub 仓库的 Actions 页,等 Pages 工作流显示绿色,大约 1~3 分钟后访问 https://myq0721.github.io 即可(必要时 Ctrl+F5 强刷)。
各命令是干什么的
命令 何时用
npm run server
仅本地预览,不会更新线上
npm run build
仅本地生成 public/,不会更新线上(排查构建错误时用)
git add / commit / push
更新线上的关键步骤
hexo deploy
一般不用再跑(已改为 Actions 发布;除非你自己要用 gh-pages 分支)
若还改了站点或主题配置
除了文章,还动了这些文件时,一并 git add:git add source/_posts/ _config.yml themes/matery/_config.yml source/_data/git commit -m "post: 更新文章与站点配置"git push origin master
新建一篇文章hexo new "文章标题"