hugo v0.149.0 版本更新介绍
发布日期: 2025-08-27
版本号: v0.149.0
Hugo v0.149.0 版本更新包含多项错误修复和新功能改进,主要亮点包括:基于新发布的 Go 1.25 构建;新增
collections.D模板函数用于生成随机整数序列;引入:sectionslug和:sectionslugs两个新的固定链接标记,特别适用于多语言项目;改进了 Markdown 目录的渲染效果;为hugo gen chromastyles添加了--omitClassComments选项;以及在transform.Unmarshal中新增了format选项。此外,还修复了内容创建、服务器重建和内容适配器文件删除时的相关问题,并更新了多项依赖库。
更新内容 (中文)
[!NOTE] 如果在 Netlify 上运行,请确保已使用其最新的构建镜像配置构建,参见此问题。
Hugo v0.149.0 包含错误修复和一系列新功能/改进,特别值得注意的是:
- 我们现在使用新发布的 Go 1.25 进行构建
- 新增 collections.D 模板函数,该函数使用 J. S. Vitter 的 Method D 生成随机整数序列,有时被称为 The Best Algorithm No One Knows About
- 新增两个永久链接令牌:
:sectionslug和:sectionslugs,在多语言 Hugo 项目中特别有用 hugo gen chromastyles新增--omitClassComments标志- 对 Markdown 生成目录的渲染方式进行了几处改进,参见 #13401 和 #12605
- transform.Unmarshal 新增
format选项
注意事项
- 移除使用了已弃用路径的测试 80e973ea5 @bep
错误修复
- 创建:修复带未来日期的新内容命令 bb4e66cd7 @justuswilhelm #12599
- 修复一次性添加包含资源的新叶束时的服务器重建问题 13b43e611 @bep #13925
- 修复删除内容适配器文件时的重建问题 87e100e61 @bep
改进
- tpl/collections:为 collections.D 添加集成测试 84b512391 @bep
- tpl/collections:使用 Vitter 的 Method D 实现顺序随机采样的 collections.D 1ba80874e @bep
- 命令:弃用 chromastyles 命令上的 –omitEmpty 选项 61ec7a20a @bep
- 命令:为 chromastyles 命令添加 –omitClassComments 选项 c289fcaaa @bep
- 全部:使用 slices.Equal ecdef2be7 @minxinyi
- resources/page:添加 :sectionslug 和 :sectionslugs 永久链接令牌 12ace3ad5 @DustinFischer #13788
- 升级到 Go 1.25 c14fdddad @bep #13924 #13931
- common/hcontext:替换为外部包 186934feb @bep
- resources/page:使用 reflect.TypeFor bff4dddb1 @cuiweixie
- tpl/strings:移除不必要的错误检查 348aae91e @Nigel2392
- markup/goldmark:渲染目录时应用 Hugo Goldmark Extras 61482cfab @jmooring #12605
- markup/goldmark:清理目录标题文本 5fdcc0906 @jmooring #13401
- 为 partialCached 死锁预防添加键 221602862 @n1xx1 #13889
- transform:为 transform.Unmarshal 添加 “format” 选项支持 ecc3dd1f5 @n1xx1 #13887
- 跳过 CI 上的不稳定测试 de4a7f1e0 @bep
依赖更新
- build(deps): 将 github.com/getkin/kin-openapi 从 0.132.0 更新到 0.133.0 45ec2f88b @dependabot[bot]
- build(deps): 将 google.golang.org/api 从 0.247.0 更新到 0.248.0 84dd495f2 @dependabot[bot]
- build(deps): 将 github.com/evanw/esbuild 从 0.25.6 更新到 0.25.9 327bbc613 @dependabot[bot]
- build(deps): 将 gocloud.dev 从 0.40.0 更新到 0.43.0 2447138f1 @dependabot[bot]
- deps: 升级 github.com/alecthomas/chroma/v2 v2.19.0 => v2.20.0 cfc38ecfe @bep #13917
- build(deps): 将 github.com/aws/aws-sdk-go-v2/service/cloudfront 更新到 22e579e05 @dependabot[bot]
- build(deps): 将 github.com/tdewolff/minify/v2 从 2.23.11 更新到 2.24.0 b886615d1 @dependabot[bot]
- build(deps): 将 github.com/tdewolff/minify/v2 从 2.23.8 更新到 2.23.11 885cd299b @dependabot[bot]
- build(deps): 将 github.com/olekukonko/tablewriter 从 1.0.8 更新到 1.0.9 debf3c559 @dependabot[bot]
- build(deps): 将 google.golang.org/api 从 0.237.0 更新到 0.247.0 1649f3126 @dependabot[bot]
- build(deps): 将 github.com/aws/aws-sdk-go-v2 从 1.36.4 更新到 1.38.0 ccd6a4b71 @dependabot[bot]
- build(deps): 将 golang.org/x/tools 从 0.35.0 更新到 0.36.0 6dc1a1752 @dependabot[bot]
- build(deps): 将 github.com/bep/simplecobra 从 0.6.0 更新到 0.6.1 806d4848c @dependabot[bot]
- build(deps): 将 golang.org/x/mod 从 0.25.0 更新到 0.27.0 04ee1b978 @dependabot[bot]
- build(deps): 将 github.com/yuin/goldmark 从 1.7.12 更新到 1.7.13 7a86fe990 @dependabot[bot]
- build(deps): 将 golang.org/x/image 从 0.28.0 更新到 0.30.0 f5245a7d5 @dependabot[bot]
- deps: 升级 github.com/niklasfasching/go-org v1.8.0 => v1.9.1 5029676ac @jmooring #13846
文档
- 杂项:将 README 中的 Go 版本更新为 1.24.0 291241595 @jmooring
- 更新 README.md 01b0eda96 @bep
更新内容 (原始)
[!NOTE]
If running on Netlify, make sure you have configured your build with their latest build image, see this issue.
Hugo v0.149.0 comes with bug fixes and a set of new features/improvements, notably:
- We now build with the recently released Go 1.25
- A new collections.D template function that generates random sequences of integers using J. S. Vitter’s Method D, by some called The Best Algorithm No One Knows About.
- Two new permalinks tokens,
:sectionslugand:sectionslugs, especially useful in multilingual Hugo projects. - A new
--omitClassCommentsflag onhugo gen chromastyles - Several improvements to how ToC from Markdown gets rendered, see #13401 and #12605.
- A new
formatoption in transform.Unmarshal
Note
- Remove test with deprecated path usage 80e973ea5 @bep
Bug fixes
- create: Fix new content command with future dates bb4e66cd7 @justuswilhelm #12599
- Fix server rebuild when adding a new leaf bundle with resources in one go 13b43e611 @bep #13925
- Fix rebuild when deleting a content adapter file 87e100e61 @bep
Improvements
- tpl/collections: Add an integration test for collections.D 84b512391 @bep
- tpl/collections: Add collections.D using Vitter’s Method D for sequential random sampling 1ba80874e @bep
- commands: Deprecate –omitEmpty on chromastyles command 61ec7a20a @bep
- commands: Add –omitClassComments to the chromastyles command c289fcaaa @bep
- all: Use slices.Equal ecdef2be7 @minxinyi
- resources/page: Add :sectionslug and :sectionslugs permalink tokens 12ace3ad5 @DustinFischer #13788
- Upgrade to Go 1.25 c14fdddad @bep #13924 #13931
- common/hcontext: Replace with external package 186934feb @bep
- resources/page: Use reflect.TypeFor bff4dddb1 @cuiweixie
- tpl/strings: Remove unnecessary error check 348aae91e @Nigel2392
- markup/goldmark: Apply Hugo Goldmark Extras when rendering TOC 61482cfab @jmooring #12605
- markup/goldmark: Sanitize TOC heading titles 5fdcc0906 @jmooring #13401
- Add a key to the partialCached deadlock prevention 221602862 @n1xx1 #13889
- transform: Add support for “format” option in transform.Unmarshal ecc3dd1f5 @n1xx1 #13887
- Skip flakey test on CI de4a7f1e0 @bep
Dependency Updates
- build(deps): bump github.com/getkin/kin-openapi from 0.132.0 to 0.133.0 45ec2f88b @dependabot[bot]
- build(deps): bump google.golang.org/api from 0.247.0 to 0.248.0 84dd495f2 @dependabot[bot]
- build(deps): bump github.com/evanw/esbuild from 0.25.6 to 0.25.9 327bbc613 @dependabot[bot]
- build(deps): bump gocloud.dev from 0.40.0 to 0.43.0 2447138f1 @dependabot[bot]
- deps: Upgrade github.com/alecthomas/chroma/v2 v2.19.0 => v2.20.0 cfc38ecfe @bep #13917
- build(deps): bump github.com/aws/aws-sdk-go-v2/service/cloudfront 22e579e05 @dependabot[bot]
- build(deps): bump github.com/tdewolff/minify/v2 from 2.23.11 to 2.24.0 b886615d1 @dependabot[bot]
- build(deps): bump github.com/tdewolff/minify/v2 from 2.23.8 to 2.23.11 885cd299b @dependabot[bot]
- build(deps): bump github.com/olekukonko/tablewriter from 1.0.8 to 1.0.9 debf3c559 @dependabot[bot]
- build(deps): bump google.golang.org/api from 0.237.0 to 0.247.0 1649f3126 @dependabot[bot]
- build(deps): bump github.com/aws/aws-sdk-go-v2 from 1.36.4 to 1.38.0 ccd6a4b71 @dependabot[bot]
- build(deps): bump golang.org/x/tools from 0.35.0 to 0.36.0 6dc1a1752 @dependabot[bot]
- build(deps): bump github.com/bep/simplecobra from 0.6.0 to 0.6.1 806d4848c @dependabot[bot]
- build(deps): bump golang.org/x/mod from 0.25.0 to 0.27.0 04ee1b978 @dependabot[bot]
- build(deps): bump github.com/yuin/goldmark from 1.7.12 to 1.7.13 7a86fe990 @dependabot[bot]
- build(deps): bump golang.org/x/image from 0.28.0 to 0.30.0 f5245a7d5 @dependabot[bot]
- deps: Upgrade github.com/niklasfasching/go-org v1.8.0 => v1.9.1 5029676ac @jmooring #13846
Documentation
- misc: Update Go version to 1.24.0 in README 291241595 @jmooring
- Update README.md 01b0eda96 @bep
下载链接
- hugo_0.149.0_checksums.txt
- hugo_0.149.0_darwin-universal.tar.gz
- hugo_0.149.0_dragonfly-amd64.tar.gz
- hugo_0.149.0_freebsd-amd64.tar.gz
- hugo_0.149.0_Linux-64bit.tar.gz
- hugo_0.149.0_linux-amd64.deb
- hugo_0.149.0_linux-amd64.tar.gz
- hugo_0.149.0_linux-arm.tar.gz
- hugo_0.149.0_linux-arm64.deb
- hugo_0.149.0_linux-arm64.tar.gz
- hugo_0.149.0_netbsd-amd64.tar.gz
- hugo_0.149.0_openbsd-amd64.tar.gz
- hugo_0.149.0_solaris-amd64.tar.gz
- hugo_0.149.0_windows-amd64.zip
- hugo_0.149.0_windows-arm64.zip
- hugo_extended_0.149.0_darwin-universal.tar.gz
- hugo_extended_0.149.0_Linux-64bit.tar.gz
- hugo_extended_0.149.0_linux-amd64.deb
- hugo_extended_0.149.0_linux-amd64.tar.gz
- hugo_extended_0.149.0_linux-arm64.deb
- hugo_extended_0.149.0_linux-arm64.tar.gz
- hugo_extended_0.149.0_windows-amd64.zip
- hugo_extended_withdeploy_0.149.0_darwin-universal.tar.gz
- hugo_extended_withdeploy_0.149.0_Linux-64bit.tar.gz
- hugo_extended_withdeploy_0.149.0_linux-amd64.deb
- hugo_extended_withdeploy_0.149.0_linux-amd64.tar.gz
- hugo_extended_withdeploy_0.149.0_linux-arm64.deb
- hugo_extended_withdeploy_0.149.0_linux-arm64.tar.gz
- hugo_extended_withdeploy_0.149.0_windows-amd64.zip