Logic / 关于Hugo的使用--极简教程

Created Sun, 13 Jul 2025 20:57:18 +0800 Modified Tue, 23 Sep 2025 21:25:27 +0800
175 Words

关于Hugo极简教程

安装环境–windows平台

使用 Chocolatey(推荐,最简单)

安装 Chocolatey 包管理器(如果尚未安装): 以管理员身份打开 PowerShell,运行:

Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))

安装 Hugo(扩展版):

choco install hugo-extended -y

验证安装:

hugo version

创建post

创建新站点

cd my-hugo-site

添加主题(示例)

git init
git submodule add https://github.com/theNewDynamic/gohugo-theme-ananke.git themes/ananke
echo "theme = 'ananke'" >> hugo.toml

创建内容

hugo new posts/first-post.md

启动本地服务器

hugo server -D