Hugo 0.57: The Cascading Edition
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:
- 37336+ stars
- 440+ contributors
- 334+ themes
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
- Add FileInfo to resources created with resources.Match etc. 1089cfe4 @bep #6190
- Improve the server assets cache invalidation logic cd575023 @bep #6199
- Do not fail build on errors in theme.toml 63150981 @bep #6162
- Add resources.Match and resources.GetMatch b64617fe @bep #6190
- Convert from testify to quicktest 9e571827 @bep
- Avoid unnecessary conversions 6027ee11 @muesli
- Simplify code a93cbb0d @muesli
- Implement cascading front matter bd98182d @bep #6041
- Use the SVG logo in README.md c0eef3b4 @XhmikosR
- Add a branch bundle test case 82439520 @bep #6173
- Simplify page tree logic 7ff0a8ee @bep #6154#6153#6152
- Merge pull request #6149 from bep/sort-caseinsensitive 53077b0d @bep
- Regenerate CLI docs 02b947ea @bep
- Add “hugo config mounts” command d7c233af @bep #6144
- Cleanup the hugo config command 45ee8a7a @bep #6144
- Move the mount duplicate filter to the modules package 4b6c5eba @bep
- Allow overlap in module mounts edf9f0a3 @bep #6146
- Add some more content language test assertions 84bc8d84 @bep #6136
- Add proper error message when receiving nil in Resource transformation e5f96024 @bep #6128
- Merge branch ‘release-0.56.1’ 9f497e7b @bep
- Update go-org to v0.1.2 56908509 @niklasfasching
- Do not return error on params dot access on incompatible types e393c629 @bep #6121
- Set GO111MODULE=on e5fe3789 @bep #6114
- Skip resource cache init if the fs is missing da4c4a77 @bep #6113
Fixes
Core
- Fix output format handling of mix cased page kinds de876242 @bep #4528
- Fix broken test 9ef4dca3 @bep
- Fix bundle header clone logic 0e086785 @bep #6136
Other
- Fix faulty -h logic in hugo mod get 17ca8f0c @bep #6197
- Fixed ineffectual assignments c577a9ed @muesli
- Fixed tautological error conditions e88d7989 @muesli
- Fix static sync issue with virtual mounts 166a394a @bep #6165
- Cache the next position of
urlreplacer.prefix
a843ca53 @vazrupe #5942 - Fix no-map vs noMap discrepancy 02397e76 @bep #6166
- Fix assorted typos f7f549e3 @XhmikosR
- common/collections: Fix typo 6512d128 @shawnps
- Fix multilingual example compatibility with latest version b8758de1 @robinwassen
- Fix self-mounts on the main project 36220851 @bep #6143
- Fix config reloading in Vim and similar 6eca0a3d @bep #6139
- Fix Jekyll import e28bd4c0 @bep #6131
- Fix image format detection for upper case extensions, e.g. JPG c62bbf7b @bep #6137
- Fix i18n project vs theme order 00a238e3 @bep #6134
- Fix image Width/Height regression 93d02aab @bep #6120
Улучшить эту страницу