发布日期: 2026-02-18
版本号: v0.156.0

本次更新显著提升了集合操作的速度,并主要进行API清理以简化理解。弃用了多个站点和页面的旧方法(如Site.AllPages、Page.Sites),同时移除了自v0.136.0起已弃用的模板函数、页面方法等。此外,修复了若干问题,更新了依赖项,并对构建和文档进行了调整。

更新内容 (中文)

本版本显著提升了 collections.Wherecollections.Sort 的性能——但主要是一次"大扫除"式更新,旨在使 API 更清晰简洁、便于理解/文档化。

弃用

  • Site.AllPages 已弃用
  • Site.BuildDrafts 已弃用
  • Site.Languages 已弃用
  • Site.Data 已弃用,请使用 hugo.Data
  • Page.Sites 和 Site.Sites 已弃用,请使用 hugo.Sites

详见此主题了解更多信息。

移除

以下功能自 v0.136.0 起至少已弃用,且任何使用长期以来均被记录为错误:

模板函数

  • data.GetCSV / getCSV(请使用 resources.GetRemote)
  • data.GetJSON / getJSON(请使用 resources.GetRemote)
  • crypto.FNV32a(请使用 hash.FNV32a)
  • resources.Babel(请使用 js.Babel)
  • resources.PostCSS(请使用 css.PostCSS)
  • resources.ToCSS(请使用 css.Sass)

页面方法:

  • .Page.NextPage(请使用 .Page.Next)
  • .Page.PrevPage(请使用 .Page.Prev)

分页器:

  • .Paginator.PageSize(请使用 .Paginator.PagerSize)

站点方法:

  • .Site.LastChange(请使用 .Site.Lastmod)
  • .Site.Author(请使用 .Site.Params.Author)
  • .Site.Authors(请使用 .Site.Params.Authors)
  • .Site.Social(请使用 .Site.Params.Social)
  • .Site.IsMultiLingual(请使用 hugo.IsMultilingual)
  • .Sites.First(请使用 .Sites.Default)

站点配置:

  • paginate(请使用 pagination.pagerSize)
  • paginatePath(请使用 pagination.path)

文件缓存:

  • getjson 缓存
  • getcsv 缓存

备注

  • 移除 <= v0.136.0 弃用的项目(注)af5051e7 @bep
  • hugolib:将 site.Data 移至 hugo.Data,弃用 Site.AllPages/BuildDrafts/Languages 86aa6252 @bep #14521
  • hugolib:添加 Page.Sites 至 Site.Sites 弃用通知 4148eded @jmooring #14532
  • resources/page:弃用 cascade._target,改用 cascade.target 828ee720 @jmooring #14341
  • tpl/tplimpl:调用 gist 短代码时抛出错误 4384f9b8 @jmooring #14491
  • tpl/tplimpl:调用 twitter/twitter_simple 短代码时抛出错误 55d136dd @jmooring #14488

错误修复

  • tpl/internal:替换弃用的 parser.ParseDir 和 doc.New 4a641d15 @bep #14513
  • commands:修复 –panicOnWarning 标志在模块版本警告时无效的问题 3f9d0ad2 @bep #14524
  • paths:修复 _ 作为路径名的处理 32027e50 @khayyamsaleem #14344
  • docs:修复 docs.yaml 中 lineNos 默认值 498431d6 @jmooring
  • hugolib:修复分类法名称包含空格时的术语标题 773664b8 @bep #13422

改进

  • hugolib:简化站点集合 bba2aed3 @bep
  • hugolib:调整 hugo.Sites.Default 29b8e17d @bep #14531
  • 将 common/hugo/HugoInfo 移至 resources/page 3c823408 @bep
  • hugolib:添加 hugo.Sites 和 .Site.IsDefault(),修改 .Site.Sites ab62320d @jmooring #14479 #14481
  • output:移除未使用方法 8d19f5a7 @bep #14522
  • 更新 CONTRIBUTING.md 中的 AI 辅助指南 77294735 @bep
  • tpl/collections:提升 where 和 sort 性能 47e39af2 @bep
  • commands:跳过无所有者写入权限文件的 chmod 操作 7850e7ce @jmooring #14507
  • tpl/collections:为 where 和 sort 添加更多基准测试 2e5132d8 @bep
  • all:在适当位置将 site 改为 project 19ab3f58 @jmooring #14504
  • markup/highlight:允许 lineNos 为 true、false、“inline” 或 “table” 3158a512 @jmooring #13481
  • 升级至 Go 1.26 b358a65c @bep
  • tpl:部分内存键改用 xxhash 替代 md5 8ae5e1a8 @bep
  • testscripts/commands:将 ‘future’ 日期更新为遥远未来 e2776593 @toddy15 #14486

依赖更新

  • build(deps): 将 google.golang.org/api 从 0.255.0 升至 0.267.0 d8ec0eee @dependabot[bot]
  • build(deps): 更新 github.com/bep/textandbinarywriter 21be4afd @dependabot[bot]
  • build(deps): 将 github.com/bep/simplecobra 从 0.6.1 升至 0.7.0 e549016b @dependabot[bot]
  • build(deps): 将 github.com/bep/tmc 从 0.5.1 升至 0.6.0 a392906b @dependabot[bot]
  • build(deps): 更新 github.com/gohugoio/hugo-goldmark-extensions/extras 86786c91 @dependabot[bot]
  • build(deps): 更新 github.com/gohugoio/hugo-goldmark-extensions/passthrough 7a7308ae @dependabot[bot]
  • build(deps): 将 golang.org/x/tools 从 0.41.0 升至 0.42.0 2d1d7312 @dependabot[bot]
  • build(deps): 将 github.com/bep/helpers 从 0.6.0 升至 0.7.0 b26fbf80 @dependabot[bot]
  • build(deps): 将 golang.org/x/image 从 0.35.0 升至 0.36.0 73583091 @dependabot[bot]

构建设置

  • snap:停止为 ppc64el 和 s390x 构建 e6f01bb4 @jmooring #14519
  • 重新应用"release:支持 alpha、beta 和 RC 版本" de0c9f3e @jmooring #14466

文档

  • docs:重新生成 docs.yaml 8b7b6af9 @bep
  • docker:添加完整 tar 和 openssh-client 以支持 GitHub Actions 71377148 @jmooring #14502

更新内容 (原始)

This release brings significant speedups of collections.Where and collections.Sort – but this is mostly a “spring cleaning” release, to make the API cleaner and simpler to understand/document.

Deprecated

  • Site.AllPages is Deprecated
  • Site.BuildDrafts is Deprecated
  • Site.Languages is Deprecated
  • Site.Data is deprecated, use hugo.Data
  • Page.Sites and Site.Sites is Deprecated, use hugo.Sites

See this topic for more info.

Removed

These have all been deprecated at least since v0.136.0 and any usage have been logged as an error for a long time:

Template functions

  • data.GetCSV / getCSV (use resources.GetRemote)
  • data.GetJSON / getJSON (use resources.GetRemote)
  • crypto.FNV32a (use hash.FNV32a)
  • resources.Babel (use js.Babel)
  • resources.PostCSS (use css.PostCSS)
  • resources.ToCSS (use css.Sass)

Page methods:

  • .Page.NextPage (use .Page.Next)
  • .Page.PrevPage (use .Page.Prev)

Paginator:

  • .Paginator.PageSize (use .Paginator.PagerSize)

Site methods:

  • .Site.LastChange (use .Site.Lastmod)
  • .Site.Author (use .Site.Params.Author)
  • .Site.Authors (use .Site.Params.Authors)
  • .Site.Social (use .Site.Params.Social)
  • .Site.IsMultiLingual (use hugo.IsMultilingual)
  • .Sites.First (use .Sites.Default)

Site config:

  • paginate (use pagination.pagerSize)
  • paginatePath (use pagination.path)

File caches:

  • getjson cache
  • getcsv cache

Notes

  • Remove items deprecated <= v0.136.0 (note) af5051e7 @bep
  • hugolib: Move site.Data to hugo.Data, deprecate Site.AllPages/BuildDrafts/Languages 86aa6252 @bep #14521
  • hugolib: Add Page.Sites to Site.Sites deprecation notice 4148eded @jmooring #14532
  • resources/page: Deprecate cascade._target in favor of cascade.target 828ee720 @jmooring #14341
  • tpl/tplimpl: Throw error when calling gist shortcode 4384f9b8 @jmooring #14491
  • tpl/tplimpl: Throw error when calling twitter/twitter_simple shortcodes 55d136dd @jmooring #14488

Bug fixes

  • tpl/internal: Replace deprecated parser.ParseDir and doc.New 4a641d15 @bep #14513
  • commands: Fix –panicOnWarning flag having no effect with module version warnings 3f9d0ad2 @bep #14524
  • paths: Fix handling of _ as a path name 32027e50 @khayyamsaleem #14344
  • docs: Fix lineNos default value in docs.yaml 498431d6 @jmooring
  • hugolib: Fix term title when taxonomy name contains spaces 773664b8 @bep #13422

Improvements

  • hugolib: Simplify sites collection bba2aed3 @bep
  • hugolib: Adjust hugo.Sites.Default 29b8e17d @bep #14531
  • Move common/hugo/HugoInfo to resources/page 3c823408 @bep
  • hugolib: Add hugo.Sites and .Site.IsDefault(), modify .Site.Sites ab62320d @jmooring #14479 #14481
  • output: Remove unused method 8d19f5a7 @bep #14522
  • Update AI assistance guidelines in CONTRIBUTING.md 77294735 @bep
  • tpl/collections: Speed up where and sort performance 47e39af2 @bep
  • commands: Skip chmod for files without owner-write permission 7850e7ce @jmooring #14507
  • tpl/collections: Add some more benchmarks for where and sort 2e5132d8 @bep
  • all: Change site to project where appropriate 19ab3f58 @jmooring #14504
  • markup/highlight: Allow lineNos to be true, false, “inline”, or “table” 3158a512 @jmooring #13481
  • Upgrade to Go 1.26 b358a65c @bep
  • tpl: Move from md5 to xxhash for some in memory keys 8ae5e1a8 @bep
  • testscripts/commands: Update ‘future’ date to far future e2776593 @toddy15 #14486

Dependency Updates

  • build(deps): bump google.golang.org/api from 0.255.0 to 0.267.0 d8ec0eee @dependabot[bot]
  • build(deps): bump github.com/bep/textandbinarywriter 21be4afd @dependabot[bot]
  • build(deps): bump github.com/bep/simplecobra from 0.6.1 to 0.7.0 e549016b @dependabot[bot]
  • build(deps): bump github.com/bep/tmc from 0.5.1 to 0.6.0 a392906b @dependabot[bot]
  • build(deps): bump github.com/gohugoio/hugo-goldmark-extensions/extras 86786c91 @dependabot[bot]
  • build(deps): bump github.com/gohugoio/hugo-goldmark-extensions/passthrough 7a7308ae @dependabot[bot]
  • build(deps): bump golang.org/x/tools from 0.41.0 to 0.42.0 2d1d7312 @dependabot[bot]
  • build(deps): bump github.com/bep/helpers from 0.6.0 to 0.7.0 b26fbf80 @dependabot[bot]
  • build(deps): bump golang.org/x/image from 0.35.0 to 0.36.0 73583091 @dependabot[bot]

Build Setup

  • snap: Stop building for ppc64el and s390x e6f01bb4 @jmooring #14519
  • Reapply “release: Support alpha, beta, and RC releases” de0c9f3e @jmooring #14466

Documentation

  • docs: Regenerate docs.yaml 8b7b6af9 @bep
  • docker: Add full tar and openssh-client to support GitHub Actions 71377148 @jmooring #14502

下载链接