本地环境操作:
1.windows下载hugo环境
https://gohugo.io/getting-started/installing/
2.下载git
https://www.git-scm.com/download/
3.下载node
https://nodejs.org/zh-cn/download/
4.安装完成后,初始化博客
hugo new site myblog

5.新建文章
hugo new post/blog.md
6.选定主题
https://themes.gohugo.io/
将选择的主题克隆至本地themes中,打开其中的exampleSite文件,将配置文件复制到hugo主目录
7.本地运行博客
hugo server -t pure
8.生成public文件
hugo --theme=pure --baseUrl="https://brightsails.github.io"
9.进入文件,并且对git进行初始化,上传至github仓库
cd public/
//git初始化
git init
//将文件增加至git
git add .
//本次提交的描述
git commit -m "第er次commit"
//git用户设置
git config --global user.name"brightsails"
//git用户设置
git config --global user.email"**********"
//将github仓库与本地文件关联
git remote add origin https://github.com/BrightSails/brightsails.github.io.git
//上传
git push -u origin master
10.更新GitHub仓库
主页面下:
hugo
public页面下:
git add -A
git commit -m "描述"
git push -u origin master
11.若出现错误
To github.com:peTzxz/Property-management-system
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'git@github.com:peTzxz/Property-management-system'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
出现这个问题是因为github中的README.md文件不在本地代码目录中,可以通过如下命令进行代码合并,解决方法:
git pull --rebase origin master
git push origin master
GitHub操作:
1.新建博客存储仓库

仓库有名字为github名字且全为小写+github.io

2.新建图床仓库
仓库有名字随便写
3.配置图床
- 下载picgo软件
https://picgo.github.io/PicGo-Doc/zh/guide/
- 创建token



将显示出来的token保存(只出现一次)
- 打开picgo,填入相关信息

4.图片的链接
-
打开GitHub建立的图床仓库,复制地址,将其中的blob改为raw,例如:
https://github.com/BrightSails/pic/raw/master/hugoblog_configpic.png
博客的优化
1.pure\layouts\partials\footer.html中修改:

2.pure\layouts\partials\_widgets\board.html中修改:
&&
3.pure\i18n\zh.yaml中修改:
