Scripts2026年4月12日·1 分钟阅读

Hugo — The Fastest Framework for Building Websites

Hugo is the fastest static site generator in the world, written in Go. Builds thousands of pages in milliseconds with Go templates, Markdown content, shortcodes, and a powerful taxonomy system. Used by 1Password, Kubernetes, Let's Encrypt docs, and many more.

SC
Script Depot · Community
快速使用

先拿来用,再决定要不要深挖

这里应该同时让用户和 Agent 知道第一步该复制什么、安装什么、落到哪里。

brew install hugo                           # macOS
snap install hugo                           # Linux
scoop install hugo-extended                 # Windows

hugo new site mysite
cd mysite
git init
git submodule add https://github.com/theNewDynamic/gohugo-theme-ananke themes/ananke
echo "theme = 'ananke'" >> hugo.toml
hugo new content posts/hello.md
hugo server -D                              # Dev server at :1313
hugo                                        # Build to public/

Content file content/posts/hello.md:

---
title: "Hello World"
date: 2026-04-12
draft: false
tags: ["intro", "hugo"]
---

This is my first Hugo post.
介绍

Hugo is the fastest static site generator, written in Go by Bjorn Erik Pedersen and Steve Francia. Builds 10,000+ pages in under a second. Uses Go templates for layouts, Markdown for content, and a powerful taxonomy/section system. Trusted by 1Password, Kubernetes, Cloudflare, Linode, and many documentation sites.

What Hugo Does

  • Blazing fast builds — 10K pages in <1s
  • Markdown content — with front matter (YAML/TOML/JSON)
  • Go templates — layouts, partials, shortcodes
  • Taxonomies — tags, categories, custom
  • Sections — content organization by directory
  • i18n — multi-language support
  • Asset pipeline — Sass, PostCSS, JS bundling, image processing
  • Data templates — JSON, CSV, TOML data files
  • Shortcodes — reusable content snippets
  • Themes — 400+ community themes

Architecture

Single Go binary. Reads Markdown + templates from disk, renders HTML to public/. No runtime deps, no Node.js, no Ruby. Content model: sections (directories) + taxonomies (tags/categories) + front matter metadata.

Comparison

Generator Language Speed Templating
Hugo Go Fastest Go templates
Astro JS Fast JSX/MDX
Jekyll Ruby Slow Liquid
Eleventy JS Fast Multiple
Zola Rust Very fast Tera
Gatsby JS Slow React

常见问题 FAQ

Q: Hugo vs Astro? A: Hugo 纯静态、Go 模板、最快构建速度;Astro 支持 React/Vue/Svelte 组件、Islands 架构、更灵活但需要 Node.js。纯文档/博客选 Hugo,交互式内容选 Astro。

Q: 主题怎么选? A: https://themes.gohugo.io 有 400+ 主题。推荐 PaperMod(博客)、Docsy(文档)、Ananke(入门)。

来源与致谢 Sources

讨论

登录后参与讨论。
还没有评论,来写第一条吧。

相关资产