为什么是 Hugo

Hugo 是用 Go 写的静态站点生成器:一个二进制文件,构建几百篇文章也只要几百毫秒,模板就是 Go 的 html/template。作为 Go 开发者,出了问题能直接看懂。

主题选了 PaperMod:极简单栏,自带亮/暗切换、站内搜索、代码高亮和复制按钮。

部署

代码推到 GitHub,Cloudflare Pages 监听仓库,每次 push 自动构建、自动发布,全球 CDN,免费。

以后怎么写文章

cd blog
hugo new content posts/my-new-post.md   # 生成草稿
hugo server -D                          # 本地预览 http://localhost:1313

写完把文章头里的 draft: true 改成 false,提交推送即可上线。

代码高亮测试

g, ctx := errgroup.WithContext(ctx)
g.SetLimit(8)
for _, id := range ids {
	g.Go(func() error { return fetch(ctx, id) })
}
return g.Wait()