v0.158.0

gohugoio/hugov0.158.0Mar 16, 2026by bep

AI Summary

Adds `css.Build` for fast CSS bundling and upgrades to Go 1.26.1. It also deprecates and removes several legacy configuration options and template functions.

Key Highlights

  • Add `css.Build` for native CSS bundling, transformation, and minification.
  • Upgrade to Go 1.26.1 (fixes CVE-2026-27142).
  • Deprecate `languageCode` in favor of `locale` and other language config methods.
  • Add `strings.ReplacePairs` for fast string replacement.

Breaking Changes

  • Remove `data.GetCSV`/`getCSV` (use `resources.GetRemote`).
  • Remove `data.GetJSON`/`getJSON` (use `resources.GetRemote`).
  • Remove `crypto.FNV32a` (use `hash.FNV32a`).
  • Remove `resources.Babel` (use `js.Babel`).
  • Remove `resources.PostCSS` (use `css.PostCSS`).
  • Remove `resources.ToCSS` (use `css.Sass`).
  • Remove `Page.NextPage` (use `Page.Next`).
  • Remove `Page.PrevPage` (use `Page.Prev`).
  • Remove `Paginator.PageSize` (use `Paginator.PagerSize`).
  • Remove `Site.LastChange` (use `Site.Lastmod`).
  • Remove `Site.Author` (use `Site.Params.Author`).
  • Remove `Site.Authors` (use `Site.Params.Authors`).
  • Remove `Site.Social` (use `Site.Params.Social`).
  • Remove `Site.IsMultiLingual` (use `hugo.IsMultilingual`).
  • Remove `Sites.First` (use `Sites.Default`).
  • Remove `paginate` (use `pagination.pagerSize`).
  • Remove `paginatePath` (use `pagination.path`).
  • Remove `getjson` cache.
  • Remove `getcsv` cache.

New Features

  • CSS variable injection support in `css.Build`.
  • Fast string replacement with `strings.ReplacePairs`.

Full Release Notes

This release adds [css.Build](https://gohugo.io/functions/css/build/), native and very fast bundling/transformation/minifying of CSS resources. Also see the new [strings.ReplacePairs](https://gohugo.io/functions/strings/replacepairs/), a very fast option if you need to do many string replacements.

## Notes

* Upgrade to to Go 1.26.1 (#14597) (note) 1f578f16 @bep #14595. This fixes a security issue in Go's template package used by Hugo: https://www.cve.org/CVERecord?id=CVE-2026-27142

## Deprecations

The methods and config options are deprecated and will be removed in a future Hugo release. 

Also see [this article](https://discourse.gohugo.io/t/deprecations-in-v0-158-0/56869)

### Language configuration

- `languageCode` → Use `locale` instead.
- `languages.<lang>.languageCode` → Use `languages.<lang>.locale` instead.
- `languages.<lang>.languageName` → Use `languages.<lang>.label` instead.
- `languages.<lang>.languageDirection` → Use `languages.<lang>.direction` instead.

### Language methods

- `.Site.LanguageCode` → Use `.Site.Language.Locale` instead.
- `.Language.LanguageCode` → Use `.Language.Locale` instead.
- `.Language.LanguageName` → Use `.Language.Label` instead.
- `.Language.LanguageDirection` → Use `.Language.Direction` instead.

## Bug fixes

* tpl/css: Fix external source maps e431f90b @bep #14620 
* hugolib: Fix server no watch 59e0446f @jmooring #14615 
* resources: Fix context canceled on GetRemote with per-request timeout 842d8f10 @bep #14611 
* tpl/tplimpl: Prefer early suffixes when media type matches 4eafd9eb @bep #13877 #14601 
* all: Run go fix ./... e3108225 @bep 
* internal/warpc: Fix SIGSEGV in Close() when dispatcher fails to start c9b88e4d @bep #14536 
* Fix index out of range panic in fileEventsContentPaths f797f849 @bep #14573 

## Improvements

* resources: Re-publish on transformation cache hit 3c980c07 @bep #14629 
* create/skeletons: Use css.Build in theme skeleton 404ac000 @jmooring #14626 
* tpl/css: Add a test case for rebuilds on CSS options changes 06fcb724 @bep 
* hugolib: Allow regular pages to cascade to self 9b5f1d49 @jmooring #14627 
* tpl/css: Allow the user to override single loader entries 623722bb @bep #14623 
* tpl/css: Make default loader resolution for CSS @import and url() always behave the same a7cbcf15 @bep #14619 
* internal/js: Add default mainFields for CSS builds 36cdb2c7 @jmooring #14614 
* Add css.Build 3e3b849c @bep #14609 #14613 
* resources: Use full path for Exif etc. decoding error/warning messages c47ec233 @bep #12693 
* Move to new locales library and upgrade CLDR from v36.1 to v48.1 4652ae4a @bep 
* tpl/strings: Add strings.ReplacePairs function 13a95b9c @jmooring #14594 
* github: Remove pull_request_template.md 54c80487 @bep 
* testing: Make commands tests pass in Go 1.26.1 157bfddd @bep 
* refactor: Deprecate language configuration and template methods d4f2122d @jmooring #14269 
* Replace Exif with Meta in tests 991d2f9a @bep 
* resources: Improve getImageOps error message e8577771 @jmooring #14571 
* resources/images: Add IsImageResourceWithMeta etc. tests for bmp and gif 44dc3847 @bep #14568 

## Dependency Updates

* deps: Upgrade github.com/evanw/esbuild v0.27.3 => v0.27.4 0e46a97e @bep 
* build(deps): bump github.com/getkin/kin-openapi from 0.133.0 to 0.134.0 c27d9e8f @dependabot[bot] 
* build(deps): bump golang.org/x/tools from 0.42.0 to 0.43.0 098eac59 @dependabot[bot] 
* build(deps): bump gocloud.dev from 0.44.0 to 0.45.0 87f8de8c @dependabot[bot] 
* build(deps): bump golang.org/x/sync from 0.19.0 to 0.20.0 67ef6c68 @dependabot[bot] 
* build(deps): bump golang.org/x/net from 0.50.0 to 0.51.0 (#14569) b29c2f7a @dependabot[bot] 
* build(deps): bump github.com/tdewolff/minify/v2 from 2.24.9 to 2.24.10 (#14585) e91d1911 @dependabot[bot] 
* build(deps): bump github.com/bep/imagemeta from 0.15.0 to 0.17.0 (#14584) a8a54bd0 @dependabot[bot]