hugo v0.164.0 版本更新介绍
发布日期: 2026-07-06
版本号: v0.164.0
Hugo新版本主要更新包括:Chroma高亮样式现支持暗色/亮色配对;新增编码函数HexEncode、HexDecode以及哈希函数crypto.Hash;提供RST语法高亮配置选项;增加Pandoc引用功能;模板渲染方法Page.Render支持子路径布局;修复了v0.128.0版本中引入的性能回退问题。同时废弃了resources.PostProcess,改用templates.Defer。其他变更包括模板名称查找不区分大小写、新增创建内容占位符等。依赖项方面升级了多个第三方库。
更新内容 (中文)
本版本的显著新功能包括:
- Chroma 高亮样式现引入 深色/浅色配对模式。同时请参阅 hugo gen chromastyles 命令新增的参数。
- 新增模板函数 encoding.HexEncode、encoding.HexDecode 与 crypto.Hash。
- 新增 markup.rst.syntaxHighlight 配置选项。
- 新增 Pandoc 引文支持。
- 现在支持传递给 Page.Render 的布局模板中的子路径。
- 本版本同时修复了 Hugo v0.128.0 引入的性能回退问题。该问题在较大站点中尤为明显。相关背景可参阅此讨论帖。
注意事项
- tpl/resources:弃用 resources.PostProcess,改用 templates.Defer (29ed9325 @bep #15086)
变更内容
- all:重写测试中的弃用代码 (5a5f4a54 @bep)
- tpl/tplimpl:支持传递给 .Render 的布局模板中的子路径 (d83ce27a @bep #15056)
- 新增 markup.rst.syntaxHighlight 选项 (c6acc246 @bep #5349)
- tpl/resources:弃用 resources.PostProcess,改用 templates.Defer (29ed9325 @bep #15086)
- tpl/collections:在 IsSet 不支持类型警告中包含键名 (671897ae @bejaratommy #11794)
- create:确保新内容占位符可正常构建 (499794d1 @sjh9714 #15078)
- hugio:优化 hasBytesWriter 性能 (65c82178 @bep)
- tpl/crypto:新增 crypto.Hash (dfb35dcd @bep #15072)
- 新增 encoding.HexDecode/Encode 函数 (a5ec5423 @bep #15068 #15060)
- tpl/tplimpl:模板名称查找现不区分大小写 (e46d37a9 @jmooring #15057)
- hugolib:当模板未找到时,.Render 应返回错误 (fe067352 @jmooring #15052)
- markup/pandoc:新增引文支持 (128fb17c @jmooring #15062)
依赖项更新
- build(deps):升级 github.com/JohannesKaufmann/html-to-markdown/v2 (921db7b5 @dependabot[bot])
- build(deps):升级 golang.org/x/tools 至 0.47.0 (786ce71e @dependabot[bot])
- build(deps):升级 golang.org/x/image 至 0.43.0 (5ad28461 @dependabot[bot])
- build(deps):升级 golang.org/x/net 至 0.56.0 (36ad9f58 @dependabot[bot])
- build(deps):升级 github.com/pelletier/go-toml/v2 至 2.4.3 (7c0a0bc9 @dependabot[bot])
- build(deps):升级 github.com/getkin/kin-openapi 至 0.140.0 (a879ebfa @dependabot[bot])
- build(deps):升级 golang.org/x/mod 至 0.37.0 (332d5ec8 @dependabot[bot])
- build(deps):升级 github.com/pelletier/go-toml/v2 至 2.4.2 (212cc11a @dependabot[bot])
- deps:升级 github.com/evanw/esbuild 至 v0.28.1 (884439b9 @bep #15033)
- deps:新增 Chroma 深色/浅色模式支持 (790a8aa4 @bep #15017)
更新内容 (原始)
Notable new features in this release are:
- The Chroma highlighter styles now introduces dark/light pairs. See also the new flags on the hugo gen chromastyles command.
- New template funcs encoding.HexEncode, encoding.HexDecode, and crypto.Hash.
- New markup.rst.syntaxHighlight option.
- We added Pandoc citation support.
- We now spport sub paths in layouts passed to Page.Render.
- This release also fixes a performance regression introduced in Hugo v0.128.0. This should mostly be prominent in bigger sites. See this discussion for some background.
Notes
- tpl/resources: Deprecate resources.PostProcess in favour of templates.Defer 29ed9325 @bep #15086
Changes
- all: Rewrite deprecated constructs in tests 5a5f4a54 @bep
- tpl/tplimpl: Support sub paths in layouts passed to .Render d83ce27a @bep #15056
- Add markup.rst.syntaxHighlight option c6acc246 @bep #5349
- tpl/resources: Deprecate resources.PostProcess in favour of templates.Defer 29ed9325 @bep #15086
- tpl/collections: Include key in IsSet unsupported-type warning 671897ae @bejaratommy #11794
- create: Keep new content placeholders buildable 499794d1 @sjh9714 #15078
- hugio: Speedup hasBytesWriter 65c82178 @bep
- tpl/crypto: Add crypto.Hash dfb35dcd @bep #15072
- Add encoding.HexDecode/Encode a5ec5423 @bep #15068 #15060
- tpl/tplimpl: Make template name lookup case-insensitive e46d37a9 @jmooring #15057
- hugolib: Return error from .Render when template not found fe067352 @jmooring #15052
- markup/pandoc: Add citation support 128fb17c @jmooring #15062
Dependency Updates
- build(deps): bump github.com/JohannesKaufmann/html-to-markdown/v2 921db7b5 @dependabot[bot]
- build(deps): bump golang.org/x/tools from 0.45.0 to 0.47.0 786ce71e @dependabot[bot]
- build(deps): bump golang.org/x/image from 0.42.0 to 0.43.0 5ad28461 @dependabot[bot]
- build(deps): bump golang.org/x/net from 0.55.0 to 0.56.0 36ad9f58 @dependabot[bot]
- build(deps): bump github.com/pelletier/go-toml/v2 from 2.4.2 to 2.4.3 7c0a0bc9 @dependabot[bot]
- build(deps): bump github.com/getkin/kin-openapi from 0.139.0 to 0.140.0 a879ebfa @dependabot[bot]
- build(deps): bump golang.org/x/mod from 0.36.0 to 0.37.0 332d5ec8 @dependabot[bot]
- build(deps): bump github.com/pelletier/go-toml/v2 from 2.3.1 to 2.4.2 212cc11a @dependabot[bot]
- deps: Upgrade github.com/evanw/esbuild v0.28.0 => v0.28.1 884439b9 @bep #15033
- deps: Add Chroma dark/light mode support 790a8aa4 @bep #15017
下载链接
- hugo_0.164.0_checksums.txt
- hugo_0.164.0_darwin-universal.pkg
- hugo_0.164.0_dragonfly-amd64.tar.gz
- hugo_0.164.0_freebsd-amd64.tar.gz
- hugo_0.164.0_Linux-64bit.tar.gz
- hugo_0.164.0_linux-amd64.deb
- hugo_0.164.0_linux-amd64.tar.gz
- hugo_0.164.0_linux-arm.tar.gz
- hugo_0.164.0_linux-arm64.deb
- hugo_0.164.0_linux-arm64.tar.gz
- hugo_0.164.0_netbsd-amd64.tar.gz
- hugo_0.164.0_openbsd-amd64.tar.gz
- hugo_0.164.0_solaris-amd64.tar.gz
- hugo_0.164.0_windows-amd64.zip
- hugo_0.164.0_windows-arm64.zip
- hugo_extended_0.164.0_darwin-universal.pkg
- hugo_extended_0.164.0_Linux-64bit.tar.gz
- hugo_extended_0.164.0_linux-amd64.deb
- hugo_extended_0.164.0_linux-amd64.tar.gz
- hugo_extended_0.164.0_linux-arm64.deb
- hugo_extended_0.164.0_linux-arm64.tar.gz
- hugo_extended_0.164.0_windows-amd64.zip
- hugo_extended_withdeploy_0.164.0_darwin-universal.pkg
- hugo_extended_withdeploy_0.164.0_Linux-64bit.tar.gz
- hugo_extended_withdeploy_0.164.0_linux-amd64.deb
- hugo_extended_withdeploy_0.164.0_linux-amd64.tar.gz
- hugo_extended_withdeploy_0.164.0_linux-arm64.deb
- hugo_extended_withdeploy_0.164.0_linux-arm64.tar.gz
- hugo_extended_withdeploy_0.164.0_windows-amd64.zip
- hugo_withdeploy_0.164.0_darwin-universal.pkg
- hugo_withdeploy_0.164.0_Linux-64bit.tar.gz
- hugo_withdeploy_0.164.0_linux-amd64.deb
- hugo_withdeploy_0.164.0_linux-amd64.tar.gz
- hugo_withdeploy_0.164.0_linux-arm64.deb
- hugo_withdeploy_0.164.0_linux-arm64.tar.gz
- hugo_withdeploy_0.164.0_windows-amd64.zip