hugo/docs/content/en/news/0.57.0-relnotes/index.md

13 KiB


date: 2019-08-14 title: "Hugo 0.57: The Cascading Edition" description: "Hugo 0.57 brings cascading front matter, alphabetical sorting, resource loading from Assets with wildcards. And it's faster." categories: ["Releases"]

Hugo 0.57 brings Cascading Front Matter, Alphabetical Sorting, Resources Loading from Assets with Wildcards. And more.

Cascading Front Matter: We have added a new and powerful cascade keyword to Hugo's front matter. This can be added to any index node in _index.md. Any values in cascade will be merged into itself and all the descendants.

title: "My Blog"
icon: "world.png"
cascade:
   icon: "flag.png"
   outputs: ["HTML"]
   type: "blog"

It's worth noting that the cascade element itself will also be merged. Also, to grasp the full value of this feature, remember that front matter in Hugo is both data and behaviour: You can tell Hugo how to process a subset of the pages (some example keywords are layout, type, outputs, weight) using the cascade keyword, e.g. "I want this subsection to be rendered in both the HTML and Calendar Output Formats".

This feature is created by@regisphilibert and @bep See #6041 for details.

Resources Loading from Assets with Wildcards: We have added two new sought after template functions to the resources namespace: resources.Match and resources.GetMatch. These behaves like their namesake methods on Page (with super-asterisk wildcard support), but searches in all the resources in Assets. E.g. {{ $prettyImages := resources.Match "images/**pretty.jpg" }} will give a slice of all "pretty pictures". Another relevant example: {{ $js := resources.Match "libs/*.js" | resources.Concat "js/bundle.js" }}.

Performance: In general, this version is slightly faster and more memory effective. In particular, we have fixed a performance issue with the replacer step that greatly improves the build speed of certain large and content-rich sites (thanks to @vazrupe for the fix).

This release represents 46 contributions by 8 contributors to the main Hugo code base.@bep leads the Hugo development with a significant amount of contributions, but also a big shoutout to @muesli, @XhmikosR, and @vazrupe for their ongoing contributions.

And a big thanks to @digitalcraftsman and @onedrawingperday for their relentless work on keeping the themes site in pristine condition and to @kaushalmodi for his great work on the documentation site.

Many have also been busy writing and fixing the documentation in hugoDocs, which has received 13 contributions by 7 contributors. A special thanks to @regisphilibert, @bep, @kenberkeley, and @davidsneighbour for their work on the documentation site.

Hugo now has:

Notes

  • All string sorting in Hugo is now alphabetical/lexicographical.
  • home.Pages now only returns pages in the top level section. Before this release, it included all regular pages in the site. This made it easy to list all the pages on home page, but it also meant that you needed to take special care if you wanted to navigate the page tree from top to bottom. If you need all regular pages, use .Site.RegularPages. Also see #6153.
  • .Pages now include sections. We have added .RegularPages as a convenience method if you want the old behaviour. See #6154 for details.
  • Hugo now only "auto create" sections for the home page and the top level folders. The other sections need a _index.md file. See #6171 for details.

Enhancements

Templates

Core

Other

Fixes

Core

Other