UNCLASSIFIED - NO CUI

Skip to content

Master: Renovate: Automerge Update dependency without new findings

Ghost User requested to merge development into master

This MR contains the following updates:

Package Type Update Change
gohugoio/hugo ironbank-github minor v0.89.4 -> v0.90.1
gohugoio/hugo minor v0.89.4 -> v0.90.1

Release Notes

gohugoio/hugo

v0.90.1

Compare Source

This release contains some fixes and improvements related to error handling in remote lookups in resources.Get, as introduced in Hugo 0.90.0:

  • Now we will always return nil (never fail the build) when a resource is not found, also for remote resources (HTTP status code 404). This means that you can do {{ with $img }}{{ else }}{{/* insert a default image or something */}}{{ end }} and similar constructs, not having to consider where the resource source lives.
  • Fetching resources remotely over HTTPS has a much greater chance of failing (network down, server down) than reading a file from disk (if not already cached). And having this lead to a failing build is not always optimal. This release allows you to handle/ignore these errors in the templates if needed, see details below.

The return value from resources.Get now includes an .Err method that will be set if the call failed. If you want to just log any error as a WARNING you can use a construct similar to the one below.

{{ with resources.Get "https://gohugo.io/images/gohugoio-card-1.png" }}
  {{ with .Err }}
    {{ warnf "%s" . }}
  {{ else }}
    <img src="{{ .RelPermalink }}" width="{{ .Width }}" height="{{ .Height }}" alt="">
  {{ end }}
{{ end }}

Note that if you do not handle .Err yourself, Hugo will fail the build the first time you start using the failed Resource object.

Changes

v0.90.0

Compare Source

Hugo 0.90 finally brings remote support to resources.Get, XML support (in /data and transform.Unmarshal), and a new images.Text filter. A special shoutout and thanks to @​vanbroup for his work on these features.

The support for remote Resources in resources.Get has been a feature in great demand. This means that you can fetch remote files (images, JSON files, RSS feeds ...) and use them in Hugo Pipes functions as they were local. A contrived example may look like this:

{{ $font := resources.Get "https://github.com/google/fonts/raw/main/apache/roboto/static/Roboto-Black.ttf" }}
{{ $img := resources.Get "https://gohugo.io/images/gohugoio-card-1.png" }}
{{ $img = $img |

Merge request reports