Back
Featured image of post Blog Workflow

Blog Workflow

添加文章

关于notes和posts

本博客中二者的划分可查看:notes和posts区域

添加posts文章

不需要指定模板,Hugo会使用 archetypes/default.md模板来建立文档:

1hugo new post/my-first-post.md

添加notes文章

指定模板,使用命令hugo new [文件路径]/[文件名].md -k [archetype name]

比如添加JavaScript这个笔记,需要按照如下格式:

  1. ./content目录下新建javascript文件夹和_index.md
1hugo new javascript/_index.md -k note-section.md
  1. ./content/javascript目录下添加chapter:
1hugo new javascript/chapter1/_index.md -k note-section.md
  1. ./content/javascript/chapter1目录下添加每一节:
1hugo new javascript/chapter1/1.1/index.md -k note.md

最后可以用hugo server 命令查看修改效果,如果再加上--buildDrafts可以查看草稿文件 :

将本地变化推送到远程仓库

1git pull
2git add . #添加修改后的所有文件到stage area
3git commit -m "添加评论" #把stage area的文件提交到分支
4git push origin main #推送到源码仓库
5# 最后可在`https://xxxxx.github.io` 处查看发布好的网站。

改动博客样式

切换到测试分支开发

1git branch #查看所有分支
2git checkout -b test #新建并切换到test分支

完成后合并到main分支

1git switch main #切换到main分支
2git merge --no-ff -m "merge with no-ff" test #在非fast forward模式下合并分支
3git log --graph --pretty=online --abbrev-commit #可以查看合并结果
4git push origin main 
5#手动删除远程仓库内的test分支
6git branch -d test #删除本地test分支
7git fetch --prune #删除远程仓库中删除的分支的引用