发布日期: 2026-07-06
版本号: v0.164.0

Hugo新版本主要更新包括:Chroma高亮样式现支持暗色/亮色配对;新增编码函数HexEncode、HexDecode以及哈希函数crypto.Hash;提供RST语法高亮配置选项;增加Pandoc引用功能;模板渲染方法Page.Render支持子路径布局;修复了v0.128.0版本中引入的性能回退问题。同时废弃了resources.PostProcess,改用templates.Defer。其他变更包括模板名称查找不区分大小写、新增创建内容占位符等。依赖项方面升级了多个第三方库。

更新内容 (中文)

本版本的显著新功能包括:

注意事项

  • 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:

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

下载链接