Hugo

Latest version: v0.127.0

Safety actively analyzes 640528 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 11 of 47

0.111.0

Hugo `0.111.0` is the second Hugo release of the year. **Note:** There's already a [patch release](https://github.com/gohugoio/hugo/releases/tag/v0.111.1).

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](https://gohugo.io/variables/page/#page-fragments) 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](https://gohugo.io/content-management/related/#index-content-headings-in-related-content) for details, but to add some weight to the _page titles_ in the Related Content configuration you can do this:

toml
[related]
threshold = 20
includeNewer = true
toLower = false
[[related.indices]]
name = "fragmentrefs"
type = "fragments"
applyFilter = false
weight = 50


See the [Hugo Documentation](https://gohugo.io/content-management/related/) 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](https://github.com/gohugoio/hugo/releases/tag/v0.111.0). We blame it on [Go](https://github.com/golang/go/issues/58823).

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.

go-html-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 `.Fragments` structure from everywhere, even in render hooks (271318ad bep 10750)
* tpl/tplimpl: Remove the Google News internal template 66f94b49 jmooring
* Only invoke a given cached partial once 4ef9baf5 bep 4086 9588

Bug fixes

* strings: fix Truncate behavior for formatted html c0d15a28 khayyamsaleem 10399
* Fix shortcode error when closing without .Inner ae48507d bep 10672
* create: Fix typo in error message 2dad13c0 aaronhooper
* resource_transformers/tocss: Fixed hugo:vars casting a1a9c08b acclassic 10632
* markup: Fix linenos codeblock hl option case regression 73ece30d khayyamsaleem 10682
* Fix slow HTML elements collector for the pre case f9fc0e04 bep 10698
* commands: Fix server url rewrites (http status 200) 1477d0ba bep 10668
* Fix description of collections.Uniq 4ccc8cfb jmooring
* Fix shortcode detection in RenderString 16885833 bep 10654

Improvements

* Replace deprecated ioutil with io and os d453c127 alexandear
* build: Bump build images 60e6fa79 bep
* build: Update Linux ARM build image 7e51ba03 bep
* tpl/tplimpl: Remove the Google News internal template 66f94b49 jmooring
* tpl/strings: Adjust benchmark 2a61910e bep
* tpl/strings: Add BenchmarkTruncate 079d1b65 bep
* Misc ioutil deprecation adjustments a669467d bep 10732
* Remove unused temp directory e3144103 alexandear
* exif: Return the proper exposure time value in some special cases 39cc3a2a WaltCuller 10738
* Add a page template func ce524d0b bep 9339
* dartsass: Import CSS without extension at compile time 2662faf6 jmooring 10592
* Split parse and render for Goldmark 271318ad bep 10750
* related: Add config option cardinalityThreshold e442a63b bep 10744
* Throw an error when shortcode is expected to be closed 7d78a498 bep 10675
* Add some shortcode testcases 0dbeac80 bep 10671
* sass: Remove some unused leftover code b99d073c bep
* resources/sass: Remove debug statements e965cb67 jmooring 10470
* page: Move the cache double check right after the lock 586fea0d bep
* page: Add some concurrency to the building of the related page index fa2d7adf bep 10711
* related: Adjust benchmark 4346987f bep
* tocss: Simplify the hugo:vars type handling ecf3cd51 bep 10632
* Adjust tests for GO 1.20 6abd15e7 bep 10691
* tpl/internal: Sync Go template src to Go 1.20 094135ff bep 10691
* Add page fragments support to Related 90da7664 bep 10711 9339 10725
* related: Adjust benchmark 0afec0a9 bep
* related: Add benchmark 28540ed1 bep
* tpl/collections: Improve error message in Index 9af78d11 bep
* Make the HTML collector parsing more robust d33a7ebc bep 10698
* tpl/strings: Add strings.ContainsNonSpace fce08904 bep
* publisher: Add benchmark 4f4a1c00 bep
* Update CONTRIBUTING.md e2cfc3d5 bep
* Only invoke a given cached partial once 4ef9baf5 bep 4086 9588

Dependency Updates

* Revert "build(deps): bump gocloud.dev from 0.24.0 to 0.28.0 (10610)" db9f74d2 bep 10770
* build(deps): bump github.com/tdewolff/parse/v2 from 2.6.4 to 2.6.5 4d36b99a dependabot[bot]
* build(deps): bump github.com/mattn/go-isatty from 0.0.16 to 0.0.17 807237bc dependabot[bot]
* build(deps): bump golang.org/x/image 79b03b3f dependabot[bot]
* build(deps): bump golang.org/x/net from 0.4.0 to 0.7.0 4bf91b97 dependabot[bot]
* Revert "build(deps): bump github.com/getkin/kin-openapi from 0.110.0 to 0.114.0" 2a364cca bep
* deps: Upgrade github.com/yuin/goldmark v1.5.3 => v1.5.4 3fb2417c jmooring 10661
* build(deps): bump github.com/getkin/kin-openapi from 0.110.0 to 0.114.0 87c78bd3 dependabot[bot]
* deps: Upgrade github.com/alecthomas/chroma v2.4.0 => v2.5.0 69c369e1 jmooring 9890 10692
* build(deps): bump github.com/kyokomi/emoji/v2 from 2.2.10 to 2.2.11 dd37163f dependabot[bot]
* build(deps): bump gocloud.dev from 0.24.0 to 0.28.0 (10610) c3a59a7d dependabot[bot] 9778

Documentation

* docs: Another fix related docs example d5601e83 bep
* docs: Fix related docs example cedd04db bep
* cods: Regen docs helper a56b9071 bep
* Move the Related doc counter to prevent a race 5c317c55 bep 10768
* Update README.md 93ed6e44 bep

Build Setup

* build: Update to Go 1.20 4801e2e8 bep 10691
* snap: Install dart-sass-embedded for 32-bit ARM (armhf) too 76c6140c anthonyfok
* snap: Add read access for ~/.gitconfig.local and ~/.config/git/* too d4482e8b anthonyfok 10337

0.110.0

Note

* Make readFile return nil when file not found (note) 3c51625c bep 9620
* Make hugo.toml the new config.toml f38a2fbd bep 8979

Bug fixes

* Fix permalinks issue with repeated sections 671f64b2 bep 10377
* Fix HEAD method in resources.GetRemote f13531e6 bep 10604
* Fix order when reading custom headers in resources.GetRemote b5d48506 bep 10616
* resource: Fix Go Doc vs .Data.Integrity fbc3e08c bep

Improvements

* related: Handly []any d5954190 bep 10624
* tpl/strings: Add findRESubmatch 2fb40ece bep 10594
* config/security: Add GO\w+ (e.g. GOROOT) to the default allowed list c6b38876 bep 10429
* Preserve front matter slice value types (e.g. int) 21af5b35 bep 10624
* Make hugo.toml the new config.toml f38a2fbd bep 8979
* Add fill HTTP Response info into .Data in resources.GetRemote 6a579eba bep 10604
* tpl/compare: Sort special float values as string f95fd57a acclassic 10389
* tpl/diagrams: Move Goat to its own file e754d5cb bep
* Update CONTRIBUTING.md 002cd528 bep
* Update CONTRIBUTING.md a76c405d bep

Dependency Updates

* deps: Upgrade github.com/evanw/esbuild v0.15.18 => v0.17.0 6e9fa9e0 bep 10536

Documentation

* dos: Regen CLI docs 19e96056 bep
* docs: Regen docshelper 80e8bd3b bep
* Update README.md c4f3a46c bep
* Misc doc, code refactoring to improve documentation e402d91e bep
* Update README.md c0a03a2a bep

Build Setup

* Remove reference to Goreleaser in code comment dd6d0a6d omarkohl

0.109.0

<img src="https://user-images.githubusercontent.com/394382/209377043-7c5e2506-a4a2-46c1-83af-9a77756563a9.png" width=40% height=40% align=right>

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 year[^1].

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](https://gohugo.io/hugo-pipes/scss-sass/#options) and you can finally just do:

handlebars
{{ $vars := dict "color1" "blue" "color2" "green" "font_size" "24px" }}
{{ $opts := (dict "transpiler" "dartsass" "outputStyle" "compressed" "vars" $vars ) }}
{{ $r := resources.Get "scss/main.scss" | toCSS $opts }}

And then in the SCSS file:

scss
use "hugo:vars" as v;

p {
color: v.$color1;
font-size: v.$font-size;
}


More examples [here](https://discourse.gohugo.io/t/initialize-sass-variables-from-hugo-templates/42053/).

Hugo Module Workspaces

Workspace support was added in [Go 1.18](https://go.dev/blog/get-familiar-with-workspaces), 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](https://gohugo.io/hugo-modules/configuration/) setting, which for this use is commonly controlled via the `HUGO_MODULE_WORKSPACE` OS environment variable.

See the [hugo.work](https://github.com/gohugoio/hugoDocs/blob/master/hugo.work) file in the Hugo Docs repo for an example:

0.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](https://gohugo.io/templates/render-hooks/).

Now you can get by this annoyance by setting `markup.goldmark.parser.wrapStandAloneImageWithinParagraph = false`

toml
[markup]
[markup.goldmark]
[markup.goldmark.parser]
wrapStandAloneImageWithinParagraph = false
[markup.goldmark.parser.attribute]
block = true


In 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:

md
This is an inline image: ![Inline Image](/inline.jpg). Some more text.

![Block Image](/block.jpg)
{.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.

handlebars
{{ if .IsBlock }}<figure class="{{ .Attributes.class }}"><img src="{{ .Destination | safeURL }}" alt="{{ .Text }}" /></figure>
{{ else }}<img src="{{ .Destination | safeURL }}" alt="{{ .Text }}" />{{ end }}


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](https://gohugo.io/getting-started/configuration-markup/#goldmark) is disabled.
* `Ordinal`: Zero-based ordinal for all the images in the current document.

Bug fixes

* common/hugio: Fix multiWriteCloser.Close 5067775a bep 10505
* tpl/collections: Fix some index cases where the indices given is a slice and be more lenient with nil inputs d373774c bep 10489

Improvements

* Make the hugo env non verbose output slightly more verbose f97544a8 bep
* Add dart-sass-embedded version info to hugo env -v d8efe085 bep
* tpl/embedded: Make Open Graph's series optional b82b547a razonyang
* dartsass: Add sourceMapIncludeSources option e93138df bep
* github: Update Dart Sass Embedded to 1.56.1 7d16c3c0 bep
* markup/goldmark: Add removeSurroundingParagraph for Markdown images 63126c63 bep 8362 10492 10494 10501
* tpl/tplimpl: Allow alternate comment syntax 0b976d2b jmooring 10495
* resources: Increase timeout for http.Client a49e51fd dirtymew 10478
* config/security: Add CI env var to whitelist dc44bca9 septs
* tpl: Use consistent delimiter spacing in examples b8d5c378 jmooring

Dependency Updates

* deps: Upgrade github.com/bep/godartsass v0.15.0 => v0.16.0 f5b5b71c bep
* build(deps): bump github.com/getkin/kin-openapi from 0.109.0 to 0.110.0 50549c86 dependabot[bot]
* build(deps): bump github.com/evanw/esbuild from 0.15.16 to 0.15.18 535ea8cc dependabot[bot]
* build(deps): bump golang.org/x/text from 0.4.0 to 0.5.0 8bbec426 dependabot[bot]
* build(deps): bump github.com/evanw/esbuild from 0.15.15 to 0.15.16 0bfa293d dependabot[bot]
* deps: Upgrade github.com/bep/godartsass v0.14.0 => v0.15.0 83080df6 bep

Documentation

* docs: Add basic doc for wrapStandAloneImageWithinParagraph etc. de9c5542 bep 10492
* tpl: Misco GoDoc improvements 7d5e3ab8 bep
* docs: Regen docs helper 75f782a5 bep

0.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](https://gohugo.io/) docs site builds ~20% faster. Also, Chroma, the highlighting library, is upgraded to [v2.4.0](https://github.com/alecthomas/chroma/releases/tag/v2.4.0) with new lexers and lots of improvements.

Bug fixes

* hugo/parser: Fix shortcode boolean param parsing 00fe7e04 jmooring 10451

Improvements

* Add a cache for lexers.Get 7855b47f bep
* markup/goldmark: Improve benchmark 34d1150d bep
* commands: Create assets directory with new site 85e2ac1a jmooring 10460

Dependency Updates

* build(deps): bump github.com/getkin/kin-openapi from 0.108.0 to 0.109.0 6a004b8d dependabot[bot]
* build(deps): bump github.com/evanw/esbuild from 0.15.14 to 0.15.15 09236224 dependabot[bot]
* build(deps): bump github.com/frankban/quicktest from 1.14.3 to 1.14.4 74776726 dependabot[bot]
* build(deps): bump golang.org/x/tools from 0.2.0 to 0.3.0 63f7f0ff dependabot[bot]
* deps: Upgrade github.com/alecthomas/chroma/v2 v2.4.0 bcb62d89 bep

0.106.0

Bug fixes

* Fix taxonomy weight sort regression 52ea07d2 bep 10406
* tlp/resources: resources.Get returns nil when given empty string db945a6e shifterbit
* tpl/internal: Sync go_templates f6ab9553 bep 10411

Dependency Updates

* build(deps): bump github.com/pelletier/go-toml/v2 from 2.0.4 to 2.0.6 bafb389b dependabot[bot]
* build(deps): bump github.com/evanw/esbuild from 0.15.13 to 0.15.14 cdd83bf3 dependabot[bot]
* deps: Update the libweb version string e00220a0 bep
* deps: Upgrade github.com/bep/gowebp v0.1.0 => v0.2.0 a662ddae bep
* build(deps): bump github.com/yuin/goldmark from 1.5.2 to 1.5.3 fe08d35f dependabot[bot]
* build(deps): bump github.com/spf13/afero from 1.9.2 to 1.9.3 4b675ddd dependabot[bot]
* build(deps): bump github.com/getkin/kin-openapi from 0.107.0 to 0.108.0 24eaa290 dependabot[bot]
* build(deps): bump github.com/clbanning/mxj/v2 from 2.5.6 to 2.5.7 58a98c77 dependabot[bot]
* build(deps): bump golang.org/x/net from 0.1.0 to 0.2.0 900904fd dependabot[bot]
* build(deps): bump github.com/evanw/esbuild from 0.15.12 to 0.15.13 24eca0cb dependabot[bot]

Documentation

* docs: Regen CLI docs 0a019a1a bep
* docs: Regenerate docs helper 9f7fb0a7 bep
* Add Go 1.16+ install method to README 60e0e2c1 vgnh
* readme: Update ToC 13adf3e0 vgnh

Page 11 of 47

Links

Releases

Has known vulnerabilities

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.