使用 Hugo Modules 加载 Hugo Theme Stack 主题
iamjeremie.me-with-hugo-theme-stack — Hugo 博客模板
作者 JeremieLitzler
基于 Hugo Theme Stack 的英文博客站点模板,通过 Hugo Modules 加载主题,并配置了 GitHub Actions 自动部署与每日更新主题的定时任务。
看看你的网站会是什么样
浏览真实页面截图,比较内容排版与手机效果。点击下方缩略图切换,放大查看整页细节。
全部页面与视图 3
截图用于了解视觉与布局,交互效果请以实际项目为准。
值得关注的模板亮点
从已有项目资料中,快速了解它的特点。
内置 GitHub Action,可自动部署到公开 GitHub Pages
配置 cron 任务,每天自动更新主题
提供 validate-xml-output.mjs 脚本,在构建后校验 sitemap.xml 与 index.xml 的 XML 声明位置、标签结构及 sitemap 绝对 URL
包含 Prettier 的 Go 模板格式化配置脚本与 .prettierrc 示例
README 说明在 Netlify 之外部署时的 Go 安装与 HUGO_VERSION 环境变量设置
模板详细介绍
这是 Jeremie Litzler 英文博客(iamjeremie.me)的站点源码模板,使用 Hugo 构建,并通过 Hugo Modules 功能加载 Hugo Theme Stack 主题。仓库提供基础的主题结构与配置,同时包含 GitHub Action,用于将站点自动部署到公开的 GitHub Pages;另有一个 cron 任务每天自动更新主题。
仓库还包含构建后的 XML 输出校验脚本。README 说明,Hugo 版本不匹配时曾在 sitemap.xml 的 <?xml 声明前产生空行,导致浏览器拒绝渲染,因此 scripts/validate-xml-output.mjs 会在每次构建后检查 public/sitemap.xml 与 public/index.xml:确认 <?xml 声明位于文件最前(无 BOM、空白或空行)、标签结构良好,以及 sitemap 中的 <loc> URL 为站点 base URL 下的绝对地址。该脚本通过 npm run build:ci(Netlify 构建命令)在 Hugo 构建后运行,文件格式错误会导致部署失败。
README 还记录了手动更新主题的流程:需为混有 Golang 代码的 .html 文件配置 Prettier,仓库内提供 init-prettier-golang-html-formatter.sh 脚本,并需添加包含 prettier-plugin-go-template 的 .prettierrc 配置;推送前需先执行 hugo build。若部署到 Netlify 以外的静态托管平台,需确保机器安装 Go,并覆盖构建命令手动安装 Go,同时在环境变量 HUGO_VERSION 中指定 Hugo 版本。
适合你的项目吗?
适用场景
- 搭建个人英文博客并发布到 GitHub Pages
- 以 Hugo Theme Stack 为基础定制自己的博客站点
- 需要在每次构建时自动校验 sitemap.xml 与 RSS 输出格式的站点
- 希望主题能每日自动更新、减少手动维护的 Hugo 项目
适合人群
- 使用 Hugo 构建博客的开发者
- 希望借助 GitHub Actions 自动部署静态站点的用户
- 需要参考 Hugo Modules 加载主题与 XML 输出校验做法的项目
上手与定制指南
结合仓库当前版本的说明,按下面的资料检查内容、配置与运行要求。
- 1
推送前需执行 hugo build,并确认 Prettier 已按 README 配置支持 Go 模板的 .html 文件
- 2
构建后可通过 npm run build:ci 运行 XML 输出校验脚本
- 3
部署到 Netlify 以外的平台时,需确保主机安装 Go,并覆盖构建命令、设置 HUGO_VERSION 环境变量
- 4
分发或修改该版本代码时,需保留原作者版权声明与完整 MIT 许可声明
授权与来源资料
使用条件与限制
免费使用 · 保留许可声明本次收录的是公开仓库中采用 MIT 许可的免费版本;免费范围为该版本代码,不代表外部服务或第三方素材免费。
使用时需要遵守
- 允许免费使用、修改、商用和分发该版本代码。
- 分发代码副本或实质性部分时,保留原作者版权声明和完整 MIT 许可声明。
- 代码按现状提供;担保与责任限制以原许可证及适用法律为准。
额外费用与待核对事项
- 演示图片、字体、图标及其他第三方素材需按各自许可核对,不能仅凭代码的 MIT 许可判断。
- 域名、托管、数据库、支付或 AI 等外部服务可能另外收费。
- 部署到 Netlify 以外的静态托管平台时,托管机器必须安装 Go,否则无法构建站点。
- 在非 Netlify 平台部署时,需要覆盖默认构建命令,手动安装 Go 后再执行 Hugo 构建。
- 部署时必须通过环境变量 HUGO_VERSION 指定 Hugo 版本,且需使用 Hugo extended 版本。
- 推送代码前必须先执行 hugo build,否则构建产物可能不完整或过期。
- 手动更新主题前需配置 Prettier 及其扩展,以正确处理混有 Golang 代码的 .html 文件。
查看原文依据
Permission is hereby granted, free of charge
许可证原文
If you want to build this site using another static page hosting, you need to make sure they have Go installed in the machine.
README 原文
You need to overwrite build command to install manually Go:
README 原文
Make sure also to specify Hugo version in the environment variable `HUGO_VERSION` (Use the latest version of Hugo extended):
README 原文
**MAKE SURE TO run `hugo build` before pushing !**
README 原文
https://github.com/JeremieLitzler/iamjeremie.me-with-hugo-theme-stack/blob/master/LICENSEhttps://github.com/JeremieLitzler/iamjeremie.me-with-hugo-theme-stack/blob/master/README.mdMake sure Prettier is setup with the extension to setup `.html` files mixing Golang code with HTML.
README 原文
DeepSeek 根据仓库许可证和 README 整理 ·2026-10-11。结果仅覆盖已读取资料,依赖、图片、字体及后续条款变更以各自原文为准。
项目核对记录与介绍依据
模板资料
- 来源平台
- GitHub
- 资料与维护参考分
- 资料较完整 · 80 / 100
- 技术栈
- Hugo
- 网站类型
- 博客
这个分数如何计算
本站按许可资料(最高30分)、演示链接(12分)、预览图(10分)、Star数(15分)、记录的维护时间(15分)、描述完整度(8分)、功能记录(5分)和分类资料(5分)计算。它不是代码、安全或性能测试,也不是 Google 评分;有链接不代表已实测可用。
这个项目需要核对什么
- 记录的仓库更新时间
- 2026-09-08
- 截图检查日期
- 2026-10-11
已收录演示链接。请用你的内容与屏幕尺寸检查;有演示不代表表单、认证或支付已经可用。
目录记录的主要技术栈是 Hugo。请通过依赖清单和锁文件核对实际版本与托管要求。这些说明基于收录资料,不代表代码审计或部署实测。
查看具体选型方法 →介绍的制作与核对状态
介绍由 AI 辅助整理目录与仓库资料。仓库作者不等于这篇介绍的审核者。
审核声明: [email protected] · 2026-10-13
查看当时使用的来源资料
SHA-256: 661bd0fc9535c482e044f5b61c83469301e862be47cf25a465e4de3bb7408489
2026-10-11T21:04:15.676Z
来源文件 / 仓库# Hugo Theme Stack Starter Template
This is a quick start template for [Hugo theme Stack](https://github.com/CaiJimmy/hugo-theme-stack). It uses [Hugo modules](https://gohugo.io/hugo-modules/) feature to load the theme.
It comes with a basic theme structure and configuration. GitHub action has been set up to deploy the theme to a public GitHub page automatically. Also, there's a cron job to update the theme automatically everyday.
## Updating theme manually
Make sure Prettier is setup with the extension to setup `.html` files mixing Golang code with HTML.
In this repo, it is included:
```bash
bash init-prettier-golang-html-formatter.sh
```
Then, add a `.prettierrc` file with:
```json
{
"plugins": ["prettier-plugin-go-template"],
"overrides": [
{
"files": ["*.html"],
"options": {
"parser": "go-template",
"goTemplateBracketSpacing": true,
"bracketSameLine": true
}
},
{
"files": ["*.js", "*.ts"],
"options": {
"useTabs": true,
"printWidth": 120,
"singleQuote": true
}
}
]
}
```
**MAKE SURE TO run `hugo build` before pushing !**
Source: [gohugo Forum](https://discourse.gohugo.io/t/formatter-for-go-templates/38403)
### Deploy somewhere else than Netilf?
If you want to build this site using another static page hosting, you need to make sure they have Go installed in the machine.
You need to overwrite build command to install manually Go:
```sh
amazon-linux-extras install golang1.11 && hugo --gc --minify
```

Make sure also to specify Hugo version in the environment variable `HUGO_VERSION` (Use the latest version of Hugo extended):

## Validating generated XML outputs
A mismatched Hugo version once emitted a blank line before the `<?xml` declaration in `sitemap.xml`, which made browsers refuse to render it (the HTTP status and `Content-Type` were fine, hiding the problem).
To catch this on every build, `scripts/validate-xml-output.mjs` is a zero-dependency Node script that checks `public/sitemap.xml` and `public/index.xml` for:
- the `<?xml` declaration being the first bytes (no BOM, whitespace, or blank line),
- well-formedness (balanced tags), and
- sitemap `<loc>` URLs being absolute under the site base URL.
It runs after the Hugo build via `npm run build:ci` (the Netlify build command), so a malformed file fails the deploy. Run it locally with:
```sh
npm run build:ci
```
看看同类模板
对比同技术栈与用途的模板,找到更适合的视觉与内容结构。

hugo-PaperMod
PaperMod 是 Hugo 生态里知名度较高的主题之一,定位很明确:给博客和轻量作品集站点提供一套干净、响应式的阅读界面。
Hugo · 作品集

LoveIt
❤️A clean, elegant but advanced blog theme for Hugo 一个简洁、优雅且高效的 Hugo 主题
Hugo · 博客

hugo-coder
A minimalist blog theme for hugo.
Hugo · 博客

blowfish
Personal Website & Blog Theme for Hugo
Hugo · 博客

hugo-paper
🪺 A simple, clean, customizable Hugo theme
Hugo · 博客

hextra
Hextra 是一个 Hugo 主题,定位在文档站与博客之间:既提供侧边栏导航、目录、面包屑、分页这类文档站结构,也能承载博客内容。
Hugo · 文档
