跳过正文
  1. Posts/
  2. Tech/

用 Hugo 搭建个人博客

·1 分钟
作者
Tao
写代码,拍胶片

为什么选择 Hugo
#

Hugo 是一个用 Go 编写的静态站点生成器,有以下优点:

  • 极速构建:几千篇文章也能秒级构建
  • 单一二进制:无需 Node.js 或其他运行时
  • 内置图片处理:自动生成缩略图和 WebP 格式

安装 Hugo
#

在 macOS 上:

1
2
brew install hugo
hugo version

创建新站点
#

1
2
3
hugo new site my-blog
cd my-blog
git init

安装 Blowfish 主题
#

1
git submodule add -b main https://github.com/nunocoracao/blowfish.git themes/blowfish

本地预览
#

1
hugo server -D

打开 http://localhost:1313 即可预览。

写新文章
#

每篇文章是一个文件夹(Page Bundle),包含 index.md 和相关资源:

1
2
3
content/posts/tech/my-article/
  index.md
  screenshot.png

就是这么简单!

相关文章