安装git

点我下载

下载Hugo, 跟着官网指引创建第一个Hugo website

点我开始

提交post到github

提前在github创建一个仓库
1
2
3
4
5
6
7
8
9
# 进入前面创建的hugo网站根目录
git init
git add .
git commit -m "first commit"
# 使用SSH连接远程仓库地址
git remote add origin [仓库地址]
# 修改远程仓库地址
# git remote set-url origin [仓库地址]
git push --set-upstream origin master

部署到Cloudflare

clouflare官网

  • 注册Cloudflare账号 clouflare官网
  • 登陆Cloudflare,点击左侧菜单栏 ==Workers & Pages== ,进入Overview页面
  • 选择从github仓库添加项目,绑定github账号,并选择指定仓库
  • command输入 hugo, directory输入 public
  • 右下角点击开始部署即可

部署完成后大概一分钟就可以访问网站

更新网站内容

  • 在刚创建的Hugo网站的content目录下,添加或更新文件内容
  • 提交到github
  • Cloudflare将会自动部署,更新网站内容

配置主题

按照下方操作配置主题源

1
2
3
4
git submodule add --depth=1 https://github.com/adityatelange/hugo-PaperMod.git themes/PaperMod
git submodule update --init --recursive # needed when you reclone your repo (submodules may not get cloned automatically)
# update
# git submodule update --remote --merge

为Hugo配置主题PaperMod

1
2
3
vim hugo.toml
# 修改theme
theme = 'PaperMod'