一行命令搞定
hugo new site myblog && cd myblog
git clone https://github.com/adityatelange/hugo-PaperMod themes/PaperMod --depth=1
echo 'theme = "PaperMod"' >> hugo.toml
hugo server
打开 http://localhost:1313 你就能看到博客了。
写文章
hugo new content posts/my-first-post.md
会自动生成带 Front Matter 的 markdown 文件,写完保存,构建:
hugo # 输出到 public/
把 public/ 部署到任何静态服务器(Nginx / Caddy / GitHub Pages)就行。
部署到生产环境
推荐用 Caddy,配置极简:
your-domain.com {
root * /var/www/blog
file_server
}
Caddy 自动帮你申请和续期 Let’s Encrypt 证书,访问 https://your-domain.com 就能看到博客。