用 Hugo 十分钟搭一个静态博客

目录

静态博客是个人网站的最优选:快、安全、零维护。这篇记录我用 Hugo 搭建博客的完整流程。

为什么选 Hugo

  • 单二进制,安装即用,没有 Node 依赖
  • 构建极快,几百篇文章也是秒级
  • 主题丰富,hugo-blog-awesome 这类主题开箱即大气
  • 原生支持分类(Categories)和标签(Tags)

三步上手

# 1. 安装 Hugo (macOS / Linux / Windows 都有对应版本)
brew install hugo          # macOS
sudo apt install hugo      # Ubuntu/Debian

# 2. 创建站点
hugo new site myblog
cd myblog

# 3. 安装主题 + 写第一篇文章
git clone https://github.com/hugo-sid/hugo-blog-awesome.git themes/hugo-blog-awesome
hugo new posts/hello.md
hugo server -D             # 本地预览 http://localhost:1313

写文章

文章就是带 front matter 的 Markdown 文件,分类通过 categories 字段声明:

---
title: "我的第一篇文章"
date: 2026-08-20
categories: ["技术"]
tags: ["Hugo"]
---

正文内容...

发布

hugo --minify     # 生成 public/ 静态目录
# 把 public/ 里的文件丢到 Nginx / GitHub Pages 即可

静态博客最爽的地方:构建产物就是一堆文件,部署到哪都行