v0.141.0

gohugoio/hugov0.141.0Jan 16, 2025by bep

AI Summary

A feature-rich release introducing a new error handling mechanism, image filters, and utility functions.

Key Highlights

  • New `try` function for error handling in templates
  • New `images.Mask` and `images.QR` functions
  • New `alignx` option for `images.Text` horizontal alignment

New Features

  • New `try` function
  • New `images.Mask` function
  • New `images.QR` function
  • New `alignx` option for `images.Text`

Full Release Notes

This release adds [try](https://gohugo.io/functions/go-template/try/), a new general mechanism for handling errors within templates, a new [images.Mask](https://gohugo.io/functions/images/mask/) image filter, a new [images.QR](https://gohugo.io/functions/images/qr/)  function, a new `alignx` option to control horizontal alignment in [images.Text](https://gohugo.io/functions/images/text/), and more.


## Note

* Adjust error handling in ToMath vs try  (note) dde9d9d54 @bep #13239 
* resources: Replace error handling in GetRemote with try (note) 0918e087e @bep #13216 
* For render hooks, only fallback to HTML (or the defaultOutputFormat) template 76993369a @bep #13242 

## Bug fixes

* common/paths: Fix docstring 8b5262691 @jdbaldry 
* commands: Fix spelling in comment 60c24fc5e @bep 
* Fix branch resource overlapping bundle path c5a63a3b4 @bep #13228 
* templates: Fix handling of multiple defers in the same template 61d3d2012 @bep #13236 
* Fix NPX issue with TailwindCSS v4 cfa080181 @bep #13221 
* Fix server refresh on 404 template changes d913f46a8 @bep #13209 

## Improvements

* tpl/tplimpl: Simplify some test assertions 1fad3832a @bep 
* tpl/tplimpl: Deprecate twitter shortcode in favor of x shortcode 1191467c0 @jmooring #13214 
* commands: Set up the glboal logger early 41137077b @bep #13265 
* commands: Add --printZero to the config command 5bb156457 @bep 
* tpl/collections: Use MapRange/SetIterKey/SetIterValue for Where, Sort and Merge de7137cc3 @bep 
* tpl/collections: Add BenchmarkWhereMap 956f915f7 @bep 
* tpl/collections: Add BenchmarkSortMap a2a4166f6 @bep 
* tpl/collections: Add Merge benchmark 39f582f9f @bep 
* resources/images: Refactor golden image tests to locate them closer to the implementation 2501de7aa @bep 
* resources/images: Add some mask tests 06cc8673f @bep #13244 
* resources/images: Add images.Mask 71fae9918 @trickkiste #13244 
* tpl/tplimpl: Use plain text for image render hook alt attribute 8af04745f @jmooring 
* resources/images: Add some golden tests for images.QR 892b49110 @bep 
* tpl/images: Change signature of images.QR to images.QR TEXT OPTIONS b13d0a68e @jmooring #13230 
* resources/images: Add some golden tests for images.Text d9594a96f @bep 
* images.Text: Add "alignx" option for horizontal alignment 4a5cc2dd2 @jlskuz #10849 
* images: Rework the golden tests 9cad8d38c @bep 
* create: Respect --noBuildLock in hugo new 2a7bb1c7c @bep 
*  tpl/images: Format the QR hashes as hex 5f2adad2c @bep 
* tpl/images: Add images.QR function 4ea94c451 @jmooring #13205 
* Add try 5d2cbee98 @bep #9737 
* resources: Add FromOpts for more effective resource creation 723e3f434 @bep 
* markup/highlight: Remove noHl option 2db43f841 @jmooring #9885 

## Dependency Updates

* deps: Upgrade github.com/gohugoio/hashstructure from 0.1.0 to 0.3.0 a2edf04c2 @bep 
* build(deps): bump golang.org/x/tools from 0.28.0 to 0.29.0 f024a5050 @dependabot[bot] 
* build(deps): bump golang.org/x/net from 0.33.0 to 0.34.0 80704bc9a @dependabot[bot] 
* build(deps): bump github.com/evanw/esbuild from 0.24.0 to 0.24.2 b7b49fb0f @dependabot[bot] 
* build(deps): bump github.com/alecthomas/chroma/v2 from 2.14.0 to 2.15.0 a83797673 @dependabot[bot] 

## Documentation

* docs: Regen CLI docs 88ecc3b75 @bep 
* docs: Regen CLI docs 44628616a @bep 

## Build Setup

* snap: Always package latest stable version of Go 3682027a5 @jmooring