使用HUGO搭建个人网站。
Requirements
Git
Go
安装golong版本管理工具
- Install Bison:
bison --version #测试是否已经安装 brew install bison
- Install gvm:
bash < <(curl -s -S -L https://raw.githubusercontent.com/moovweb/gvm/master/binscripts/gvm-installer)
使用gvm下载go:
brew install go@1.22 #gvm需要先拥有一个go gvm install go1.23 gvm use go1.23 #default
Dart Sass
使用 Sass 语言的最新功能时,需要 Dart Sass 将 Sass 转译为 CSS。
brew install sass/sass/sass
HUGO下载
extended/deploy editions:可以将您的网站直接部署到 Google Cloud Storage 存储桶、AWS S3 存储桶或 Azure 存储容器。查看详细信息。
Install a C compiler, either GCC or Clang 二选一
gcc --version #check gcc是否安装 clang --version #check clang是否安装
To build the extended/deploy edition:
CGO_ENABLED=1 go install -tags extended,withdeploy github.com/gohugoio/hugo@latest
hugo version #check
构建站点-本地
创建 Hugo 项目
hugo new site --format yaml hugo new site /Users/sukixuu/Desktop/SukiBlog --format yaml #指定路径
进入项目目录并添加主题
cd /Users/sukixuu/Desktop/SukiBlog #进入目录
- Theme选择,根据文档安装;这里使用PaperMod下载:
git init
更新(以后更新使用):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)
git submodule update --remote --merge
- Theme选择,根据文档安装;这里使用PaperMod
将网站配置中的主题设置为PaperMod 在
hugo.yaml
中添加以下,并重新命名成为config.yaml
:theme: ["PaperMod"]
启动 Hugo 服务器
hugo server