Hugo 是一个用 Go 语言编写的静态网站生成器,以其极快的构建速度著称。
为什么选择 Hugo
- 速度快:每秒可以生成数千页面
- 主题丰富:有大量精美的主题可选
- 单二进制文件:单个可执行文件,无需依赖
- Markdown 支持:使用 Markdown 写作,简单高效
安装 Hugo
# macOS
brew install hugo
# Windows
choco install hugo-extended
# Linux
sudo apt install hugo
创建新站点
hugo new site myblog
cd myblog
git init
添加主题
git submodule add https://github.com/adityatelange/hugo-PaperMod.git themes/PaperMod
然后在 hugo.toml 中设置主题。
创建文章
hugo new content posts/hello.md
本地预览
hugo server -D
部署到 GitHub Pages
使用 GitHub Actions 自动部署,每次推送代码后自动构建发布。
Hugo 让搭建博客变得非常简单,推荐尝试!