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