hugo v0.159.1 版本更新介绍
发布日期: 2026-03-26
版本号: v0.159.1
本次发布的修复针对一个长期存在但较为隐蔽的问题:之前使用的SVG优化工具会错误地删除带命名空间的属性,导致依赖AlpineJS等动态绑定功能的网站(如Hugo官方文档站)出现故障。为此,上游库新增了
keepNamespaces配置选项,我们将其设置为默认保留空命名空间和x-bind命名空间,以确保AlpineJS等库能正常工作。该修复已通过配置[minify.tdewolff.svg]中的keepNamespaces参数实现,并包含在本次更新中。
更新内容 (中文)
本次版本修复的回归问题并非新问题,但它非常微妙,我们认为应尽快发布。一段时间以来,我们使用的压缩器剥离了 SVG 中的命名空间属性,这破坏了使用例如 AlpineJS 的 x-bind: 命名空间的动态构造(该库被 Hugo 的文档站点使用)。
为了解决这个问题,上游库添加了一个 keepNamespaces 切片选项。无法找到一个让所有人都满意的默认值,因此我们选择了一个至少能让 AlpineJS 站点开箱即用的选项:
[minify.tdewolff.svg]
keepNamespaces = ['', 'x-bind']
变更说明
- 压缩器:在 SVG 压缩中保留 x-bind 和空命名空间 42289d76 @bep #14669
更新内容 (原始)
The regression fixed in this release isn’t new, but it’s so subtle that we thought we’d release this sooner rather than later. For some time now, the minifier we use have stripped namespaced attributes in SVGs, which broke dynamic constructs using e.g. AlpineJS’ x-bind: namespace (library used by Hugo’s documentation site).
To fix this, the upstream library has hadded a keepNamespaces slice option. It was not possible to find a default that would make all happy, so we opted for an option that at least would make AlpineJS sites work out of the box:
[minify.tdewolff.svg]
keepNamespaces = ['', 'x-bind']
What’s Changed
- minifiers: Keep x-bind and blank namespace in SVG minification 42289d76 @bep #14669
下载链接
- hugo_0.159.1_checksums.txt
- hugo_0.159.1_darwin-universal.pkg
- hugo_0.159.1_dragonfly-amd64.tar.gz
- hugo_0.159.1_freebsd-amd64.tar.gz
- hugo_0.159.1_Linux-64bit.tar.gz
- hugo_0.159.1_linux-amd64.deb
- hugo_0.159.1_linux-amd64.tar.gz
- hugo_0.159.1_linux-arm.tar.gz
- hugo_0.159.1_linux-arm64.deb
- hugo_0.159.1_linux-arm64.tar.gz
- hugo_0.159.1_netbsd-amd64.tar.gz
- hugo_0.159.1_openbsd-amd64.tar.gz
- hugo_0.159.1_solaris-amd64.tar.gz
- hugo_0.159.1_windows-amd64.zip
- hugo_0.159.1_windows-arm64.zip
- hugo_extended_0.159.1_darwin-universal.pkg
- hugo_extended_0.159.1_Linux-64bit.tar.gz
- hugo_extended_0.159.1_linux-amd64.deb
- hugo_extended_0.159.1_linux-amd64.tar.gz
- hugo_extended_0.159.1_linux-arm64.deb
- hugo_extended_0.159.1_linux-arm64.tar.gz
- hugo_extended_0.159.1_windows-amd64.zip
- hugo_extended_withdeploy_0.159.1_darwin-universal.pkg
- hugo_extended_withdeploy_0.159.1_Linux-64bit.tar.gz
- hugo_extended_withdeploy_0.159.1_linux-amd64.deb
- hugo_extended_withdeploy_0.159.1_linux-amd64.tar.gz
- hugo_extended_withdeploy_0.159.1_linux-arm64.deb
- hugo_extended_withdeploy_0.159.1_linux-arm64.tar.gz
- hugo_extended_withdeploy_0.159.1_windows-amd64.zip