22 KiB
date: 2021-02-19 title: "Hugo 0.81.0: The Smorgasbord Edition" description: "Attribute lists (e.g. CSS classes) for Markdown blocks, newlines in template actions/blocks, native Apple M1 ARM64 binary, it's faster, and more …" categories: ["Releases"] toc: true
Hugo 0.81.0 is the first release of this decade, it is the fastest to date, and it's packed with useful new features.
Newlines in Template Actions and Commands
You can now have newlines within template actions and pipelines. This means that you can now do this and similar:
{{ dict
"country" "Norway"
"population" "5 millions"
"language" "Norwegian"
"language_code" "nb"
"weather" "freezing cold"
"capitol" "Oslo"
"largest_city" "Oslo"
"currency" "Norwegian krone"
"dialing_code" "+47"
}}
Note that the above construction will fail in Hugo versions < 0.81.0
.
Attribute Lists after Markdown Blocks
Hugo already supports adding attribute lists (e.g CSS classes) after titles. We now also allow adding attribute lists after Markdown blocks, e.g. tables, lists, paragraphs etc.:
> foo
> bar
{.myclass}
See Configure Goldmark.
Performance
This release is the fastest Hugo to date, see details in the benchmarks below. This is especially true if you use the new ARM64 MacOS binary (only works on Apple M1 devices).
Site Building and Rebuilding Benchmarks: v0.80.0 => v0.81.0
name old time/op new time/op delta
SiteNew/Edit_Bundle_with_image-16 771µs ± 6% 817µs ± 7% ~ (p=0.200 n=4+4)
SiteNew/Edit_Bundle_with_JSON_file-16 728µs ± 2% 737µs ± 1% ~ (p=0.343 n=4+4)
SiteNew/Edit_Tags_and_categories-16 16.6ms ± 5% 16.3ms ± 3% ~ (p=0.686 n=4+4)
SiteNew/Edit_Canonify_URLs-16 29.4ms ± 6% 26.9ms ± 4% -8.37% (p=0.029 n=4+4)
SiteNew/Edit_Deep_content_tree-16 33.8ms ± 3% 31.2ms ± 3% -7.53% (p=0.029 n=4+4)
SiteNew/Edit_Many_HTML_templates-16 12.1ms ± 2% 11.6ms ± 1% -3.94% (p=0.029 n=4+4)
SiteNew/Edit_Page_collections-16 20.6ms ± 1% 19.8ms ± 0% -3.57% (p=0.029 n=4+4)
SiteNew/Edit_List_terms-16 3.91ms ± 1% 3.81ms ± 2% -2.52% (p=0.029 n=4+4)
SiteNew/Regular_Bundle_with_image-16 6.15ms ± 2% 5.53ms ± 2% -10.11% (p=0.029 n=4+4)
SiteNew/Regular_Bundle_with_JSON_file-16 6.26ms ± 4% 5.76ms ± 4% -7.98% (p=0.029 n=4+4)
SiteNew/Regular_Tags_and_categories-16 26.2ms ± 2% 25.5ms ± 1% -2.42% (p=0.029 n=4+4)
SiteNew/Regular_Canonify_URLs-16 34.7ms ± 8% 33.8ms ± 9% ~ (p=0.486 n=4+4)
SiteNew/Regular_Deep_content_tree-16 43.8ms ± 1% 43.4ms ± 6% ~ (p=0.343 n=4+4)
SiteNew/Regular_Many_HTML_templates-16 21.5ms ± 1% 19.7ms ± 2% -8.54% (p=0.029 n=4+4)
SiteNew/Regular_Page_collections-16 30.7ms ± 2% 28.2ms ± 1% -8.23% (p=0.029 n=4+4)
SiteNew/Regular_List_terms-16 9.70ms ± 1% 8.95ms ± 0% -7.72% (p=0.029 n=4+4)
name old alloc/op new alloc/op delta
SiteNew/Edit_Bundle_with_image-16 437kB ± 0% 428kB ± 0% -2.02% (p=0.029 n=4+4)
SiteNew/Edit_Bundle_with_JSON_file-16 216kB ± 0% 207kB ± 0% -4.20% (p=0.029 n=4+4)
SiteNew/Edit_Tags_and_categories-16 10.4MB ± 0% 9.7MB ± 0% -6.08% (p=0.029 n=4+4)
SiteNew/Edit_Canonify_URLs-16 84.4MB ± 0% 85.2MB ± 0% +0.87% (p=0.029 n=4+4)
SiteNew/Edit_Deep_content_tree-16 26.6MB ± 0% 25.6MB ± 0% -3.57% (p=0.029 n=4+4)
SiteNew/Edit_Many_HTML_templates-16 6.03MB ± 0% 5.75MB ± 0% -4.57% (p=0.029 n=4+4)
SiteNew/Edit_Page_collections-16 14.8MB ± 0% 14.2MB ± 0% -4.10% (p=0.029 n=4+4)
SiteNew/Edit_List_terms-16 1.83MB ± 0% 1.73MB ± 0% -5.51% (p=0.029 n=4+4)
SiteNew/Regular_Bundle_with_image-16 1.93MB ± 0% 1.90MB ± 0% -1.43% (p=0.029 n=4+4)
SiteNew/Regular_Bundle_with_JSON_file-16 1.72MB ± 0% 1.69MB ± 0% -1.72% (p=0.029 n=4+4)
SiteNew/Regular_Tags_and_categories-16 14.3MB ± 0% 13.6MB ± 0% -4.80% (p=0.029 n=4+4)
SiteNew/Regular_Canonify_URLs-16 89.7MB ± 0% 90.2MB ± 0% +0.61% (p=0.029 n=4+4)
SiteNew/Regular_Deep_content_tree-16 30.4MB ± 0% 29.2MB ± 0% -3.95% (p=0.029 n=4+4)
SiteNew/Regular_Many_HTML_templates-16 9.26MB ± 0% 8.94MB ± 0% -3.47% (p=0.029 n=4+4)
SiteNew/Regular_Page_collections-16 18.5MB ± 0% 17.7MB ± 0% -4.25% (p=0.029 n=4+4)
SiteNew/Regular_List_terms-16 4.00MB ± 0% 3.85MB ± 0% -3.55% (p=0.029 n=4+4)
name old allocs/op new allocs/op delta
SiteNew/Edit_Bundle_with_image-16 3.99k ± 0% 4.07k ± 0% +1.80% (p=0.029 n=4+4)
SiteNew/Edit_Bundle_with_JSON_file-16 3.99k ± 0% 4.06k ± 0% +1.81% (p=0.029 n=4+4)
SiteNew/Edit_Tags_and_categories-16 241k ± 0% 245k ± 0% +1.67% (p=0.029 n=4+4)
SiteNew/Edit_Canonify_URLs-16 364k ± 0% 321k ± 0% -11.78% (p=0.029 n=4+4)
SiteNew/Edit_Deep_content_tree-16 264k ± 0% 268k ± 0% +1.53% (p=0.029 n=4+4)
SiteNew/Edit_Many_HTML_templates-16 90.3k ± 0% 91.0k ± 0% +0.83% (p=0.029 n=4+4)
SiteNew/Edit_Page_collections-16 153k ± 0% 156k ± 0% +1.46% (p=0.029 n=4+4)
SiteNew/Edit_List_terms-16 30.4k ± 0% 30.9k ± 0% +1.54% (p=0.029 n=4+4)
SiteNew/Regular_Bundle_with_image-16 23.3k ± 0% 23.1k ± 0% -0.57% (p=0.029 n=4+4)
SiteNew/Regular_Bundle_with_JSON_file-16 23.3k ± 0% 23.1k ± 0% -0.59% (p=0.029 n=4+4)
SiteNew/Regular_Tags_and_categories-16 284k ± 0% 288k ± 0% +1.58% (p=0.029 n=4+4)
SiteNew/Regular_Canonify_URLs-16 387k ± 0% 343k ± 0% -11.41% (p=0.029 n=4+4)
SiteNew/Regular_Deep_content_tree-16 307k ± 0% 309k ± 0% +0.52% (p=0.029 n=4+4)
SiteNew/Regular_Many_HTML_templates-16 129k ± 0% 129k ± 0% +0.35% (p=0.029 n=4+4)
SiteNew/Regular_Page_collections-16 199k ± 0% 200k ± 0% +0.55% (p=0.029 n=4+4)
SiteNew/Regular_List_terms-16 53.5k ± 0% 53.4k ± 0% -0.18% (p=0.029 n=4+4)
Native Arm Binary for Apple M1
We finally provide native Hugo binary for Apple M1 devices. Download the file named hugo_0.81.0_macOS-ARM64.tar.gz
.
JavaScript Building
- Add
inject
config option allowing you to automatically replace a global variable with an import from another file relative toassets
. 32b86076 @bep #8164 - Add
shims
config option to swap out a component with another. A common use case is to load dependencies like React from a CDN (with shims) when in production, but running with the full bundlednode_modules
dependency during development e19a046c @bep #8165 - Add external source map support to js.Build and Babel 2c8b5d91 @richtera #8132
- Fix nilpointer in js.Build error handling a1fe552f @bep #8162
Also see js.Build Options.
Hugo Modules
There are several Hugo Modules-related improvements in this release:
- Allow absolute paths for any modules resolved via project replacement 3a5ee0d2 @bep #8240
- Add config option modules.vendorClosest bdfbcf6f @bep #8235#8242
- Throw an error running hugo mod vendor on mountless module 4ffaeaf1 @bep
Minify - Keep Comments
Keep comments when running hugo --minify
with a new setting in config.toml.
[minify.tdewolff.html]
keepComments = true
The default value for this setting is false
.
Statistics
This release represents 59 contributions by 14 contributors to the main Hugo code base.@bep leads the Hugo development with a significant amount of contributions, but also a big shoutout to @moorereason and @benmezger for their ongoing contributions. And a big thanks to @digitalcraftsman for his relentless work on keeping the themes site in pristine condition and to @davidsneighbour, @coliff and @kaushalmodi for all the great work on the documentation site.
Many have also been busy writing and fixing the documentation in hugoDocs, which has received 20 contributions by 13 contributors. A special thanks to @bep, @gagarine, @fridde, and @NicoHood for their work on the documentation site.
Hugo now has:
- 50152+ stars
- 435+ contributors
- 370+ themes
Notes
- We have updated to Beta 6 of the Dart Sass Protocol which is not backwards compatible, so if you use Dart Sass you need to also update that binary.
hugo gen autocomplete
now default tostdout
; you can change this by setting--completionfile
. As an added bonus we now also support auto completion for zsh, fish and powershell.
Changelog
- Make the build green again fe77f743 @bep
- Regenerate internal templates c6080655 @bep
- Update date logic of opengraph and schema internal templates ffd9dac4 @djatwood
- Synch Go templates fork with Go 1.16dev cf3e077d @bep
- Exclude pages without Permalink from sitemap 4867cd1d @Jaza
- Add default user-agent header for getJSON requests 35def0ae @peacecwz
- remove 1mb limit for readFile. ee9c1367 @avdva
- Do not return errors in substr for out-of-bounds cases 8a26ab0b @moorereason #8113
- Add missing test scenario for strings.Substr 788e50ad @moorereason
- Regen CLI docs 9e99950c @bep
- Regen docs helper 1b364b00 @bep
- Run go mod tidy 88b93a09 @bep
- Add arm64 to Darwinextended build and add vendorInfo 29fb456c @bep #8003
- Update Travis, GitHub, CircleCI and Snap to Go 1.16 (only) 718fba7d @bep
- Pull in latest Go 1.16 template source e77b2e3a @bep
- Add breaking tests for "map read and map write in templates" b5485aea @bep #7293
- Pull in latest Go template source ccb822eb @bep
- Expand template newline testcase to commands 21e9eb18 @bep
- Add a test case for Go 1.16 template action newlines ae57ba6a @bep
- Update github.com/tdewolff/minify/v2 v2.6.2 => v2.9.13 66beac99 @bep #8258
- bump github.com/frankban/quicktest from 1.11.2 to 1.11.3 968dd7a7 @dependabot[bot]
- bump github.com/getkin/kin-openapi from 0.32.0 to 0.39.0 38f29e81 @dependabot[bot]
- bump github.com/aws/aws-sdk-go from 1.36.33 to 1.37.11 cd87813a @dependabot[bot]
- bump github.com/sanity-io/litter from 1.3.0 to 1.5.0 4e815b06 @dependabot[bot]
- bump github.com/olekukonko/tablewriter from 0.0.4 to 0.0.5 652a59d3 @dependabot[bot]
- Update to esbuild v0.8.46 84f0ec7f @bep
- Add config option modules.vendorClosest bdfbcf6f @bep #8235#8242
- bump google.golang.org/api from 0.26.0 to 0.40.0 a9b0fea6 @dependabot[bot]
- Change version string format and add VendorInfo to help with issue triaging e8df0977 @anthonyfok
- Allow absolute paths for any modules resolved via project replacement 3a5ee0d2 @bep #8240
- Throw an error running hugo mod vendor on mountless module 4ffaeaf1 @bep
- Add PowerShell completion support 5f621df2 @anthonyfok #8122
- Refer to mage instead of make in comment regarding commitHash 7118f89c @anthonyfok
- Add attributes support for blocks (tables etc.) 2681633d @bep #7548
- Update to Goldmark v1.3.2 1b247282 @bep #8143
- Update to Dart Sass Protocol beta6 441b11be @bep
- Write to stdout by default d36fd5b3 @benmezger
- Remove powershell support a7c515e1 @benmezger
- Add zsh, fish and powershell completion support 216b00f3 @benmezger #4296
- Enable NPM tests on Windows 14494379 @bep #8196
- Update to esbuild v0.8.39 440fdb0e @bep #8189
- Trim whitespace in elements written to hugo_stats.json b2a48dce @pmatiash #7958
- bump github.com/aws/aws-sdk-go from 1.35.0 to 1.36.33 2f9dadae @dependabot[bot]
- Remove mention of a file size limit for readFile ed3071b7 @avdva
- Add Inject config option 32b86076 @bep #8164
- Add Shims option e19a046c @bep #8165
- bump github.com/spf13/afero from 1.4.1 to 1.5.1 07ad283f @eclipseo
- Add external source map support to js.Build and Babel 2c8b5d91 @richtera #8132
- Run go mod tidy 4d2b6fc4 @bep
- Update go-org to v1.4.0 212e5e55 @niklasfasching
- Adjust log level 4fdec67b @bep
- Add temporary patch to fix template data race 9650e568 @bep #7293
- Fix race condition in text template baseof 241b7483 @moorereason
- Fix metrics hint tracking 0004a733 @moorereason #8125
- Fix potential path issue on Windows b60e9279 @bep
- Fix some humanize issues bf55afd7 @susiwen8 #7912
- Fix handling of legacy attribute config e6dd3128 @bep #7548
- Support translation files with suffix *.yml 92c6c404 @bep #8212
- Fix nilpointer in js.Build error handling a1fe552f @bep #8162