Releases: gohugoio/hugo
v0.111.3
Bug fixes
- Fix "unknown shortcode token" when calling shortcode within fenced code block e7148f3 @bep #10819
- Don't fail when calling Paginate with an empty pages.PagesGroup 34a86e1 @bep #10802
- Improve error message for unclosed shortcode with inner content 9818724 @deining
Improvements
- tpl: Add hasSuffix alias d171d15 @jfish2
- Run gofmt -s on source files d55af2a @deining
- tpl/math: Allow multi numbers in add, sub, mul, div, min and max 84201e8 @septs
- server: Replace golang.org/x/net/context with context 0f01bd4 @alexandear
- watcher: use time.NewTicker to prevent leaks 02ab77d @alexandear
- ensure we default to 10 correctly 873be9f @davidejones
- switch transfers to workers bebb2b8 @davidejones
- customize parallel transfer count e6f029b @davidejones
- metadecoders: Add support for native org dates in frontmatter PR #7433 added support for Org timestamps for the DATE header. This PR widens the support with additional front matter headers LASTMOD, PUBLISHDATE and EXPIRYDATE. bdbfacb @johannesengl #8536
Dependency Updates
- deps: Update go-org to v1.6.6 1c841ec @niklasfasching
Documentation
v0.111.2
Bug fixes
- Fix .Fragments when called cross sites on uninitialized output format b83050c @bep #10794
- Fix "context canceled" with partial 3bbeb56 @bep #10789
- cache: Fix --gc failure on Windows 184a67a @alexandear
- snap: Fix dart-sass-embedded installation a950950 @jmooring #10783
- Allow page.TableOfContents on self in shortcode df5608f @bep #10791
- Page context handling in i18n 6c798eb @bep #10782
- Work around --gc failure on Windows <= 10 ec1c97e @bep #10781
- Correct typos in Go comments 36ce3a4 @alexandear
Documentation
Build Setup
v0.111.1
v0.111.0
Hugo 0.111.0 is the second Hugo release of the year. Note: There's already a patch release.
Notable news
Page Fragments
We added the new .Fragments method on Page as part of the Related Content feature refresh (below), but it's plenty useful on its own, and has been long sought after by Hugo users.
It has many uses: Build table of contents, check if a page fragment (heading identifier) exists on a page, check for duplicate heading identifiers, start table of contents from a specific heading identifier. See the Hugo Documentation for more information
Indexing of Page Fragments in Related Content
We have reworked the Related Content API so it's now one method .Related that takes either a Page or an options map. We have also introduced a new type attribute on the index configuration with the new type fragments. See this for details, but to add some weight to the page titles in the Related Content configuration you can do this:
[related]
threshold = 20
includeNewer = true
toLower = false
[[related.indices]]
name = "fragmentrefs"
type = "fragments"
applyFilter = false
weight = 50See the Hugo Documentation for more.
Global page func
Note: There was a bug in this release that made this new feature not working, so you need to upgrade to Hugo 0.111.1. We blame it on Go.
Hugo almost always passes a Page as the data context into the top level template (e.g. single.html) (the one exception is the multihost sitemap template). This means that you can access the current page with the . variable in the template.
But when you're deeply nested inside .Render, partial etc., accessing that Page object isn't always practical or possible.
For this reason, Hugo now provides a global page function that you can use to access the current page from anywhere in any template.
{{ page.Title }}
Notes
- For the Goldmark markdown hander, we now split parse and render for Goldmark. This was motivated by the new fragments support in Related Content, but it has some other side effects: If you only need a page's table of contents, we now skip the rendering step, which makes it faster, but it also means that you can access the page
.Fragmentsstructure from everywhere, even in render hooks (271318a @bep #10750) - tpl/tplimpl: Remove the Google News internal template 66f94b4 @jmooring
- Only invoke a given cached partial once 4ef9baf @bep #4086 #9588
Bug fixes
- strings: fix Truncate behavior for formatted html c0d15a2 @khayyamsaleem #10399
- Fix shortcode error when closing without .Inner ae48507 @bep #10672
- create: Fix typo in error message 2dad13c @aaronhooper
- resource_transformers/tocss: Fixed hugo:vars casting a1a9c08 @acclassic #10632
- markup: Fix linenos codeblock hl option case regression 73ece30 @khayyamsaleem #10682
- Fix slow HTML elements collector for the pre case f9fc0e0 @bep #10698
- commands: Fix server url rewrites (http status 200) 1477d0b @bep #10668
- Fix description of collections.Uniq 4ccc8cf @jmooring
- Fix shortcode detection in RenderString 1688583 @bep #10654
Improvements
- Replace deprecated ioutil with io and os d453c12 @alexandear
- build: Bump build images 60e6fa7 @bep
- build: Update Linux ARM build image 7e51ba0 @bep
- tpl/tplimpl: Remove the Google News internal template 66f94b4 @jmooring
- tpl/strings: Adjust benchmark 2a61910 @bep
- tpl/strings: Add BenchmarkTruncate 079d1b6 @bep
- Misc ioutil deprecation adjustments a669467 @bep #10732
- Remove unused temp directory e314410 @alexandear
- exif: Return the proper exposure time value in some special cases 39cc3a2 @WaltCuller #10738
- Add a page template func ce524d0 @bep #9339
- dartsass: Import CSS without extension at compile time 2662faf @jmooring #10592
- Split parse and render for Goldmark 271318a @bep #10750
- related: Add config option cardinalityThreshold e442a63 @bep #10744
- Throw an error when shortcode is expected to be closed 7d78a49 @bep #10675
- Add some shortcode testcases 0dbeac8 @bep #10671
- sass: Remove some unused leftover code b99d073 @bep
- resources/sass: Remove debug statements e965cb6 @jmooring #10470
- page: Move the cache double check right after the lock 586fea0 @bep
- page: Add some concurrency to the building of the related page index fa2d7ad @bep #10711
- related: Adjust benchmark 4346987 @bep
- tocss: Simplify the hugo:vars type handling ecf3cd5 @bep #10632
- Adjust tests for GO 1.20 6abd15e @bep #10691
- tpl/internal: Sync Go template src to Go 1.20 094135f @bep #10691
- Add page fragments support to Related 90da766 @bep #10711 #9339 #10725
- related: Adjust benchmark 0afec0a @bep
- related: Add benchmark 28540ed @bep
- tpl/collections: Improve error message in Index 9af78d1 @bep
- Make the HTML collector parsing more robust d33a7eb @bep #10698
- tpl/strings: Add strings.ContainsNonSpace fce0890 @bep
- publisher: Add benchmark 4f4a1c0 @bep
- Update CONTRIBUTING.md e2cfc3d @bep
- Only invoke a given cached partial once 4ef9baf @bep #4086 #9588
Dependency Updates
- Revert "build(deps): bump gocloud.dev from 0.24.0 to 0.28.0 (#10610)" db9f74d @bep #10770
- build(deps): bump github.com/tdewolff/parse/v2 from 2.6.4 to 2.6.5 4d36b99 @dependabot[bot]
- build(deps): bump github.com/mattn/go-isatty from 0.0.16 to 0.0.17 807237b @dependabot[bot]
- build(deps): bump golang.org/x/image 79b03b3 @dependabot[bot]
- build(deps): bump golang.org/x/net from 0.4.0 to 0.7.0 4bf91b9 @dependabot[bot]
- Revert "build(deps): bump github.com/getkin/kin-openapi from 0.110.0 to 0.114.0" 2a364cc @bep
- deps: Upgrade github.com/yuin/goldmark v1.5.3 => v1.5.4 3fb2417 @jmooring #10661
- build(deps): bump github.com/getkin/kin-openapi from 0.110.0 to 0.114.0 87c78bd @dependabot[bot]
- deps: Upgrade github.com/alecthomas/chroma v2.4.0 => v2.5.0 69c369e @jmooring #9890 #10692
- build(deps): bump github.com/kyokomi/emoji/v2 from 2.2.10 to 2.2.11 dd37163 @dependabot[bot]
- build(deps): bump gocloud.dev from 0.24.0 to 0.28.0 (#10610) c3a59a7 @dependabot[bot] #9778
Documentation
- docs: Another fix related docs example d5601e8 @bep
- docs: Fix related docs example cedd04d @bep
- cods: Regen docs helper a56b907 @bep
- Move the Related doc counter to prevent a race 5c317c5 @bep #10768
- Update README.md 93ed6e4 @bep
Build Setup
- build: Update to Go 1.20 4801e2e @bep #10691
- snap: Install dart-sass-embedded for 32-bit ARM (armhf) too 76c6140 @anthonyfok
- snap: Add read access for ~/.gitconfig.local and ~/.config/git/* too d4482e8 @anthonyfok #10337
v0.110.0
Note
- Make readFile return nil when file not found (note) 3c51625 @bep #9620
- Make hugo.toml the new config.toml f38a2fb @bep #8979
Bug fixes
- Fix permalinks issue with repeated sections 671f64b @bep #10377
- Fix HEAD method in resources.GetRemote f13531e @bep #10604
- Fix order when reading custom headers in resources.GetRemote b5d4850 @bep #10616
- resource: Fix Go Doc vs .Data.Integrity fbc3e08 @bep
Improvements
- related: Handly []any d595419 @bep #10624
- tpl/strings: Add findRESubmatch 2fb40ec @bep #10594
- config/security: Add GO\w+ (e.g. GOROOT) to the default allowed list c6b3887 @bep #10429
- Preserve front matter slice value types (e.g. int) 21af5b3 @bep #10624
- Make hugo.toml the new config.toml f38a2fb @bep #8979
- Add fill HTTP Response info into .Data in resources.GetRemote 6a579eb @bep #10604
- tpl/compare: Sort special float values as string f95fd57 @acclassic #10389
- tpl/diagrams: Move Goat to its own file e754d5c @bep
- Update CONTRIBUTING.md 002cd52 @bep
- Update CONTRIBUTING.md a76c405 @bep
Dependency Updates
Documentation
- dos: Regen CLI docs 19e9605 @bep
- docs: Regen docshelper 80e8bd3 @bep
- Update README.md c4f3a46 @bep
- Misc doc, code refactoring to improve documentation e402d91 @bep
- Update README.md c0a03a2 @bep
Build Setup
v0.109.0
Hugo v0.109.0 is the last release of 2022 – and with that we're wishing all of you a very merry Christmas and a prosperous new year1.
Notable new features
Pass variables to SCSS/SASS
Hugo has had great SCSS/SASS support, but passing variables (e.g. theme colours from config) down to the transpiler has been much harder than it should.
In Hugo v0.109.0 we added a new vars option and you can finally just do:
And then in the SCSS file:
@use "hugo:vars" as v;
p {
color: v.$color1;
font-size: v.$font-size;
}More examples here.
Hugo Module Workspaces
Workspace support was added in Go 1.18, and in this release Hugo finally gets solid support for it.
A common use case for a workspace is to simplify local development of a site with its theme modules.
A workspace can be configured in a *.work file and activated with the module.workspace setting, which for this use is commonly controlled via the HUGO_MODULE_WORKSPACE OS environment variable.
See the hugo.work file in the Hugo Docs repo for an example:
go 1.19
use .
use ../gohugoioTheme
Using the use directive, list all the modules you want to work on, pointing to its relative location. As in the example above, it's recommended to always include the main project (the ".") in the list.
With that you can start the Hugo server with that workspace enabled:
HUGO_MODULE_WORKSPACE=hugo.work hugo server --ignoreVendorPaths "**"
The --ignoreVendorPaths flag is added above to ignore any of the vendored dependencies inside _vendor. If you don't use vendoring, you don't need that flag. But now the server is set up watching the files and directories in the workspace and you can see your local edits reloaded.
Breadcrumbs
We have added a new .Ancestors method on Page that walks up the tree to the home page. With this, breadcrumbs templates can be greatly simplified:
The path to /public now available in PostCSS
So you can do process.env.HUGO_PUBLISHDIR in your postcss.config.js to figure out where Hugo publishes
its files.
Note that the value will always be an absolute file path and will point to a directory on disk even when running hugo server in memory mode.
If you write to this folder from PostCSS when running the server, you could run the server with one of these flags:
hugo server --renderToDisk
hugo server --renderStaticToDisk
Note
- modules: Make the module.workspace=off as default (note) 0d4b17d @bep #10553
- release: Add a note section in release notes 3afaca7 @bep
- helpers: Allow at signs in UnicodeSanitize (note) 2d217cb @jmooring #10548
- Also consider wrapped errors when checking for file IsNotExist errors ad20598 @bep #10534
Bug fixes
- If you use the legacy
libsasstranspiler intoCSSand uses the cached build to avoid having the extended version installed on the CI server, you need to rebuild those assets and commit them to source control (e.g. withhugo --gc). - tpl/resources: Fix data race in ToCSS aa2c724 @bep #10542
- tocss: Fix unquote case with double quotes 5d5f0a2 @septs #10555
- resources/js: Fix some import discrepancies between Hugo and ESBuild b54de1b @bep #10527
- parser/metadecoders: Fix spelling e0e63f3 @lacamera
Improvements
- Adjust "you need the extended version" error message 180dfeb @bep
- resource/page: Slight adjustment of Page.Ancestors eb0c8f9 @bep #10567
- resource/page: Add Page.Ancestors 3a21618 @septs #10567
- Annotate test assertions 7183232 @jmooring
- hugolib: Exclude non-linkable pages from translations map 37ab1cf @jmooring #9073
- Add HUGO_PUBLISHDIR to the Node environment 59af05c @bep #10554
- Revert "tpl/tplimpl: Use https in sitemap templates" 4989da6 @jmooring
- tocss: Add some more test cases effa6a4 @bep #10555
- Allow "fast render mode" even if --disableLiveReload is set d20d265 @bep #10561
- tocss: Add vars option 41a080b @bep #10555
- modules: Improve "module workspace" not found error eda1e72 @bep
- modules: Adjust watch logic vs workspace use definitions 330fa89 @bep
- Add any configured Go Workspace file to the config watcher 6db5274 @bep #10556
- parser/metadecoders: Remove superflous cast in test 17055d1 @bep
- parser/metadecoders: Simplify nil check in Unmarshal 2a81a49 @bep
- parser/metadecoders: Add empty /data JSON file as empty map e30d711 @acclassic #8601
- tpl/openapi3: Wrap *kopenapi3.T 87e898a @bep
- github: Use ruby/setup-ruby d894269 @bep #10517
- tpl/tplimpl: Use https in sitemap templates 3fd0b78 @jmooring #10515
Dependency Updates
- build(deps): bump golang.org/x/tools from 0.3.0 to 0.4.0 7874b96 @dependabot[bot]
Documentation
Build Setup
-
We're working on some bigger and even more exiting Hugo features that will be ready early next year. Stay tuned!
↩
v0.108.0
With Hugo v0.108.0 you can render standalone Markdown images without a surrounding paragraph. Both the HTML- and CommonMark-specification defines image as an inline element. For Markdown, this has meant that if you put an image on its own (not inlined in another paragraph), it would be wrapped in <p></p> tags, even if you provide your own Render Hook Template.
Now you can get by this annoyance by setting markup.goldmark.parser.wrapStandAloneImageWithinParagraph = false
[markup]
[markup.goldmark]
[markup.goldmark.parser]
wrapStandAloneImageWithinParagraph = false
[markup.goldmark.parser.attribute]
block = trueIn the above we have also enabled attribute support for Markdown blocks to illustrate another nice side effect of this; it's now possible to use Markdown attributes (e.g. CSS classes) on standalone images:
This is an inline image: . Some more text.

{.blue}The images in the above Markdown example would, given the hook template below, be rendered wrapped in a figure element with the blue CSS class applied in the latter example.
Two new fields are added to the render context passed to image render hooks:
IsBlock: Returns true if this is a standalone image and the config option markup.goldmark.parser.wrapStandAloneImageWithinParagraph is disabled.Ordinal: Zero-based ordinal for all the images in the current document.
Bug fixes
- common/hugio: Fix multiWriteCloser.Close 5067775 @bep #10505
- tpl/collections: Fix some index cases where the indices given is a slice and be more lenient with nil inputs d373774 @bep #10489
Improvements
- Make the hugo env non verbose output slightly more verbose f97544a @bep
- Add dart-sass-embedded version info to hugo env -v d8efe08 @bep
- tpl/embedded: Make Open Graph's series optional b82b547 @razonyang
- dartsass: Add sourceMapIncludeSources option e93138d @bep
- github: Update Dart Sass Embedded to 1.56.1 7d16c3c @bep
- markup/goldmark: Add removeSurroundingParagraph for Markdown images 63126c6 @bep #8362 #10492 #10494 #10501
- tpl/tplimpl: Allow alternate comment syntax 0b976d2 @jmooring #10495
- resources: Increase timeout for http.Client a49e51f @dirtymew #10478
- config/security: Add CI env var to whitelist dc44bca @septs
- tpl: Use consistent delimiter spacing in examples b8d5c37 @jmooring
Dependency Updates
- deps: Upgrade github.com/bep/godartsass v0.15.0 => v0.16.0 f5b5b71 @bep
- build(deps): bump github.com/getkin/kin-openapi from 0.109.0 to 0.110.0 50549c8 @dependabot[bot]
- build(deps): bump github.com/evanw/esbuild from 0.15.16 to 0.15.18 535ea8c @dependabot[bot]
- build(deps): bump golang.org/x/text from 0.4.0 to 0.5.0 8bbec42 @dependabot[bot]
- build(deps): bump github.com/evanw/esbuild from 0.15.15 to 0.15.16 0bfa293 @dependabot[bot]
- deps: Upgrade github.com/bep/godartsass v0.14.0 => v0.15.0 83080df @bep
Documentation
v0.107.0
This release is mostly interesting if you do code highlighting. We fixed a bottle neck which should show a significant performance boost for sites using code highlighting. Hugo's gohugo.io docs site builds ~20% faster. Also, Chroma, the highlighting library, is upgraded to v2.4.0 with new lexers and lots of improvements.
Bug fixes
Improvements
- Add a cache for lexers.Get 7855b47 @bep
- markup/goldmark: Improve benchmark 34d1150 @bep
- commands: Create assets directory with new site 85e2ac1 @jmooring #10460
Dependency Updates
- build(deps): bump github.com/getkin/kin-openapi from 0.108.0 to 0.109.0 6a004b8 @dependabot[bot]
- build(deps): bump github.com/evanw/esbuild from 0.15.14 to 0.15.15 0923622 @dependabot[bot]
- build(deps): bump github.com/frankban/quicktest from 1.14.3 to 1.14.4 7477672 @dependabot[bot]
- build(deps): bump golang.org/x/tools from 0.2.0 to 0.3.0 63f7f0f @dependabot[bot]
- deps: Upgrade github.com/alecthomas/chroma/v2 v2.4.0 bcb62d8 @bep
v0.106.0
Bug fixes
- Fix taxonomy weight sort regression 52ea07d @bep #10406
- tlp/resources: resources.Get returns nil when given empty string db945a6 @shifterbit
- tpl/internal: Sync go_templates f6ab955 @bep #10411
Dependency Updates
- build(deps): bump github.com/pelletier/go-toml/v2 from 2.0.4 to 2.0.6 bafb389 @dependabot[bot]
- build(deps): bump github.com/evanw/esbuild from 0.15.13 to 0.15.14 cdd83bf @dependabot[bot]
- deps: Update the libweb version string e00220a @bep
- deps: Upgrade github.com/bep/gowebp v0.1.0 => v0.2.0 a662dda @bep
- build(deps): bump github.com/yuin/goldmark from 1.5.2 to 1.5.3 fe08d35 @dependabot[bot]
- build(deps): bump github.com/spf13/afero from 1.9.2 to 1.9.3 4b675dd @dependabot[bot]
- build(deps): bump github.com/getkin/kin-openapi from 0.107.0 to 0.108.0 24eaa29 @dependabot[bot]
- build(deps): bump github.com/clbanning/mxj/v2 from 2.5.6 to 2.5.7 58a98c7 @dependabot[bot]
- build(deps): bump golang.org/x/net from 0.1.0 to 0.2.0 900904f @dependabot[bot]
- build(deps): bump github.com/evanw/esbuild from 0.15.12 to 0.15.13 24eca0c @dependabot[bot]
Documentation
v0.105.0
Bug fixes
- Avoid nilpointer when shortcode page content output nil e5d2a8f @davidejones #10391
- Revise the fix for shortcode vs output format nilpointer 631d768 @bep #10391
Improvements
- livereload: Use text/javascript here, too 00ff161 @bep
- media: Rename application/javascript, application/typescript to text/javascript etc. 588710a @bep
- Skip flakey server tests on GitHub Action on Windows 20ef6dc @bep
- github: Avoid duplicate test runs d1cd1db @bep
- tpl/encoding: Add noHTMLEscape option to jsonify 09e1011 @bep
- Don't use self-closing generator tag 01ebb6e @djibe
- github: Use SHA versions 1fd3320 @bep
- Resolve dependency-path not found error in workflow 0fb2b3d @jongwooo
- Use setup-go action to cache dependencies db05232 @jongwooo
Dependency Updates
- build(deps): bump golang.org/x/tools from 0.1.12 to 0.2.0 f505854 @dependabot[bot]
- build(deps): bump github.com/getkin/kin-openapi from 0.106.0 to 0.107.0 2aedccc @dependabot[bot]
- build(deps): bump golang.org/x/text from 0.3.7 to 0.4.0 c109314 @dependabot[bot]
- build(deps): bump github.com/spf13/cobra from 1.5.0 to 1.6.1 4732c47 @dependabot[bot]
- build(deps): bump github.com/getkin/kin-openapi from 0.103.0 to 0.106.0 62780ec @dependabot[bot]
- build(deps): bump github.com/tdewolff/minify/v2 from 2.12.1 to 2.12.4 351d6b0 @dependabot[bot]
- build(deps): bump github.com/yuin/goldmark from 1.4.15 to 1.5.2 ed930db @dependabot[bot]
- build(deps): bump github.com/fsnotify/fsnotify from 1.5.4 to 1.6.0 05df964 @dependabot[bot]
- build(deps): bump github.com/magefile/mage from 1.13.0 to 1.14.0 9860e0e @dependabot[bot]
- build(deps): bump github.com/evanw/esbuild from 0.15.9 to 0.15.12 2ef60db @dependabot[bot]
