Chet / Hugo 博客搭建指南

Created Fri, 05 Jun 2026 11:00:00 +0800 Modified Sat, 06 Jun 2026 03:00:39 +0000

Hugo 简介

Hugo 是一个用 Go 语言编写的静态网站生成器,以其构建速度快而闻名。相比其他静态网站生成器,Hugo 有以下优势:

  • ⚡ 构建速度极快(毫秒级)
  • 🔄 跨平台支持
  • 📦 单一二进制文件,无需复杂依赖
  • 🎨 丰富的主题生态

安装 Hugo

macOS

brew install hugo

Windows

choco install hugo-extended

Linux

snap install hugo

创建新站点

hugo new site myblog
cd myblog

添加主题

将主题克隆到 themes 目录:

git clone https://github.com/MeiK2333/github-style.git themes/github-style

创建文章

hugo new post/my-first-post.md

本地预览

hugo server -D

访问 http://localhost:1313 即可预览。

构建生产版本

hugo --gc --minify

生成的静态文件在 public 目录中。