diff --git a/content/en/contribute/development.md b/content/en/contribute/development.md index f6ff44ced0..e4b183e932 100644 --- a/content/en/contribute/development.md +++ b/content/en/contribute/development.md @@ -48,7 +48,7 @@ For a complete guide to contributing to Hugo, see the [Contribution Guide]. To build the extended edition of Hugo from source you must: 1. Install [Git] -1. Install [Go] version 1.20 or later +1. Install [Go] version 1.23.0 or later 1. Install a C compiler, either [GCC] or [Clang] 1. Update your `PATH` environment variable as described in the [Go documentation] diff --git a/content/en/functions/go-template/if.md b/content/en/functions/go-template/if.md index 19c887f258..9fdf80e996 100644 --- a/content/en/functions/go-template/if.md +++ b/content/en/functions/go-template/if.md @@ -34,7 +34,7 @@ Use with the [`else`] statement: {{ end }} ``` -Use `else if` to check multiple conditions. +Use `else if` to check multiple conditions: ```go-html-template {{ $var := 12 }} diff --git a/content/en/functions/go-template/with.md b/content/en/functions/go-template/with.md index 3a73d54bbd..3d628e28dd 100644 --- a/content/en/functions/go-template/with.md +++ b/content/en/functions/go-template/with.md @@ -36,6 +36,20 @@ Use with the [`else`] statement: {{ end }} ``` +Use `else with` to check multiple conditions: + +```go-html-template +{{ $v1 := 0 }} +{{ $v2 := 42 }} +{{ with $v1 }} + {{ . }} +{{ else with $v2 }} + {{ . }} → 42 +{{ else }} + {{ print "v1 and v2 are falsy" }} +{{ end }} +``` + Initialize a variable, scoped to the current block: ```go-html-template diff --git a/content/en/templates/introduction.md b/content/en/templates/introduction.md index bb87027173..0a3ff2b0f6 100644 --- a/content/en/templates/introduction.md +++ b/content/en/templates/introduction.md @@ -509,6 +509,20 @@ See documentation for [`with`], [`else`], and [`end`]. {{ end }} ``` +To test multiple conditions: + +```go-html-template +{{ $v1 := 0 }} +{{ $v2 := 42 }} +{{ with $v1 }} + {{ . }} +{{ else with $v2 }} + {{ . }} → 42 +{{ else }} + {{ print "v1 and v2 are falsy" }} +{{ end }} +``` + ### Access site parameters See documentation for the [`Params`](/methods/site/params/) method on a `Site` object.