Hugo 0.34: Pattern matching to filter images and other resources
Hugo 0.34
is a small release. It contains a few smaller bug-fixes, but more important is an overhaul of the API used to find images and other resources in your page bundles.
We have added two simple methods on the Resources
object:
.Match
finds every resource matching a pattern. Examples:.Match "images/*.jpg"
finds every JPEG image inimages
and.Match "**.jpg"
finds every JPEG image in the bundle..GetMatch
finds the first resource matching the pattern given.
Note: The path separators used are Unix-style forward slashes, even on Windows.
It uses standard wildcard syntax with the addition of the **
, aka super-asterisk, which matches across path boundaries.
Thanks to @gobwas for a fast and easy-to-use Glob library.
This release represents 5 contributions by 1 contributors to the main Hugo code base.
Many have also been busy writing and fixing the documentation in hugoDocs, which has received 25 contributions by 16 contributors. A special thanks to @bep, @rmetzler, @chris-rudmin, and @stkevintan for their work on the documentation site.
Hugo now has:
- 22689+ stars
- 448+ contributors
- 197+ themes
Notes
Resources.GetByPrefix
andResources.ByPrefix
are deprecated. They still work, but will eventually be removed. UseResources.Match
(many) andResources.GetMatch
(one).- When filtering bundles pages in sub-folders, you need to include the sub-folder when matching. This was a bug introduced in
0.33
and gets it in line with images and other resources.
Enhancements
Fixes
Improve this page