hugo/content/en/news/0.84.0-relnotes/index.md
Bjørn Erik Pedersen 7eb0e10a80 Squashed 'docs/' changes from 710856e5a..6ebb5dad9
6ebb5dad9 Remove file
27cc23ef4 Hugo 0.84.4
94dccbfa4 Merge branch 'tempv0.84.4'
e9d8b61fb releaser: Add release notes to /docs for release of 0.84.4
51e472005 Improve readability of examples on shortcode templates page
0aef26479 Fix lookup order typos (#1484)
534a527fe Fix two typos (#1483)
394aabd5a Higo "0.84.3
03ee92c1c Merge branch 'tempv0.84.3'
96a8be0f1 releaser: Add release notes to /docs for release of 0.84.3
9a770323f Update index.md
7f65cfcbe Hugo 0.84.2
444422515 releaser: Add release notes to /docs for release of 0.84.2
a2f29c5d8 modules: Add module.import.noMounts config
e00e4a7e7 releaser: Add release notes to /docs for release of 0.84.2
af04b53b3 modules: Add module.import.noMounts config
f7d5669c7 Remove Appernetic (#1481)
14f8d4029 Clarify interaction of sections and top-level leaf bundles
d140b6a62 Update lookup-order.md
399904959 Update shortcode-templates.md
e78aa4865 Hugo 0.84.1
35d7c1c22 Merge branch 'tempv0.84.1'
a6be65b0d releaser: Add release notes to /docs for release of 0.84.1
7b3b3ca45 Hugo 0.84.0 News Grammar fixes
cbc23bf5a Remove trailing newlines
69349198d Fix erroridf docs
dbc1157c1 Fix missing deep

git-subtree-dir: docs
git-subtree-split: 6ebb5dad9a87655196c0990d88d50a2248df5c54
2021-07-04 16:34:26 +02:00

14 KiB


date: 2021-06-18 title: "Config Revamp" description: "Hugo 0.84.0: Deep merge of theme configuration, config dir support now also in themes/modules, HTTP header support in getJSON, and more." categories: ["Releases"]

This release brings several configuration fixes and improvements that will be especially useful for themes.

Deep merge of theme Params

One of the most common complaints from Hugo theme owners/users has been about the configuration handling. Hugo has up until now only performed a shallow merge of theme params into the configuration.

With that, given this example from a theme configuration:

[params]
[params.colours]
blue="#337DFF"
green="#68FF33"
red="#FF3358"

If you would like to use the above theme, but want a different shade of red, you earlier had to copy the entire block, even the colours you're totally happy with. This was painful with even the simplest setup.

Now you can just override the params keys you want to change, e.g.:

[params]
[params.colours]
red="#fc0f03"

For more information, and especially about the way you can opt out of the above behaviour, see Merge Configuration from Themes.

Themes now support the config directory

Now both the project and themes/modules can store its configuration in both the top level config file (e.g. config.toml) or in the config directory. See Configuration Directory.

HTTP headers in getJSON/getCSV

getJSON now supports custom HTTP headers. This has been a big limitation in Hugo, especially considering the Authorization header.

We have updated the internal Instagram shortcode to pass the access token in a header:

{{ $hideCaption := cond (eq (.Get 1) "hidecaption") "1" "0" }}
{{ $headers := dict "Authorization" (printf "Bearer %s" $accessToken) }}
{{ with getJSON "https://graph.facebook.com/v8.0/instagram_oembed/?url=https://instagram.com/p/" $id "/&hidecaption=" $hideCaption $headers }}
    {{ .html | safeHTML }}
{{ end }}

Also see the discussion this issue about the access token above.

New erroridf template func

Sometimes, especially when creating themes, it is useful to be able to let the user decide if an error situation is critical enough to fail the build. The new erroridf produces ERROR log statements that can be toggled off:

{{ erroridf "some-custom-id" "Some error message." }}

Will log:

ERROR: Some error message.
If you feel that this should not be logged as an ERROR, you can ignore it by adding this to your site config:
ignoreErrors = ["some-custom-id"]

Stats

This release represents 46 contributions by 11 contributors to the main Hugo code base.@bep leads the Hugo development with a significant amount of contributions, but also a big shoutout to @jmooring, @satotake, and @Seirdy for their ongoing contributions. And a big thanks to @digitalcraftsman for his relentless work on keeping the themes site in pristine condition.

Many have also been busy writing and fixing the documentation in hugoDocs, which has received 20 contributions by 10 contributors. A special thanks to @salim-b, @bep, @thomasjsn, and @lucasew for their work on the documentation site.

Hugo now has:

Notes

  • We now do deep merging of params from theme config(s). That is you most likely what you want, but Merge Configuration from Themes describes how you can get the old behaviour back.

Enhancements

Templates

Output

Other

Fixes

Templates

Other