hugo/content/news/0.34-relnotes/index.md
Bjørn Erik Pedersen 3886fc1fef Squashed 'docs/' changes from 4e7e1815b..211a3c613
211a3c613 Prepare the forestry.io article for release
23995d6b4 Add forestry.io to showcase
3f177c94e Fix some typos (found by codespell)
dc26e0a5a Clarify the default for site config files and multiple config files
c87c9c62e Review and update the Site config documentation for consistency
a29edc50c Fix the default value of rssLimit site config
83f3c46b0 Minor style fix
4f860d1a2 Typo capitalization fixes
7851345c8 Add docs about comments within templates
d129b4a28 Make the recommendation to use partial over template consistent
6cd260a41 Update index.md
a2787e1a4 Add Let’s Encrypt showcase
7e664f69e Update configuration.md
8002120f1 Update multilingual.md
702b46a62 Add documentation for the disableLanguages setting
cb3d395de Fix content type reference
d33226924 Update Page Kinds documentation
8203f649d Fix misformed markdown link
19e99c957 Add Section definition

git-subtree-dir: docs
git-subtree-split: 211a3c6136c69f49baeae6cd35e5a8853cddf710
2018-03-16 09:44:54 +01:00

2.8 KiB


date: 2018-01-22 title: "Hugo 0.34: Pattern matching to filter images and other resources" description: "Hugo 0.34 adds full glob with super-asterisk support, for example *.jpg." categories: ["Releases"]

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 in images 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:

Notes

  • Resources.GetByPrefix and Resources.ByPrefix are deprecated. They still work, but will eventually be removed. Use Resources.Match (many) and Resources.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