diff options
| author | Russ Cox <rsc@google.com> | 2021-02-26 14:24:51 -0500 |
|---|---|---|
| committer | Russ Cox <rsc@google.com> | 2021-02-26 14:24:51 -0500 |
| commit | 40f4908e4524cf7719f5bfc4e080608c1b56973b (patch) | |
| tree | 5a96a53fce78b9f60d44f11b2c32b6ac885db7c9 /go.dev | |
| parent | 78721852afb8dc52f2839dd983777b89c04d89fa (diff) | |
| download | go-x-website-40f4908e4524cf7719f5bfc4e080608c1b56973b.tar.xz | |
[x/go.dev] layouts/shortcodes: fix gopher.html template parse errors
This doesn't make sense, because each (...) is a bool,
so the first cannot be called as a function taking the second.
{{if (eq $gopher "front") (eq $gopher "sticker1")}}
I am not sure whether the current web site works with some
older versions of Hugo, but it doesn't work on my machine
with the both v0.59.1 and the latest v0.81.0. It just looks like
it's always been broken, but then I'm confused about how the
web site itself is running.
In any event, this CL fixes the condition, which is clearly meant
to be an "or" of those two:
{{if or (eq $gopher "front") (eq $gopher "sticker1")}}
But this is needlessly complex too, since eq will do that for us:
{{if eq $gopher "front" "sticker1"}}
Fixed that condition and simplified a few others.
Now hugo runs successfully.
Change-Id: I02568c4e9331c71107488d44423535186e73e809
X-GoDev-Commit: 189cbf4f05b7bb855a3dc6f95c0acc57a2ba1434
Diffstat (limited to 'go.dev')
| -rw-r--r-- | go.dev/layouts/shortcodes/gopher.html | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/go.dev/layouts/shortcodes/gopher.html b/go.dev/layouts/shortcodes/gopher.html index dfde60e0..f0cd021e 100644 --- a/go.dev/layouts/shortcodes/gopher.html +++ b/go.dev/layouts/shortcodes/gopher.html @@ -5,11 +5,11 @@ {{ $gopher := .Get "gopher"}} {{ $sizeIn := .Get "size"}} -{{if or (eq (.Get "align") "right") (eq (.Get "align") "Right")}} +{{if eq (.Get "align") "right" "Right"}} {{$align = "Right"}} {{end}} -{{if or (or (eq $sizeIn "XLarge") (eq $sizeIn "xl")) (eq $sizeIn "xlarge") }} +{{if eq $sizeIn "XLarge" "xl" "xlarge"}} {{$size = "XLarge"}} {{end}} @@ -21,7 +21,7 @@ {{$src = "/images/gophers/blue.svg"}} {{$alt = "Go gopher"}} {{end}} -{{if (eq $gopher "front") (eq $gopher "sticker1")}} +{{if eq $gopher "front" "sticker1"}} {{$src = "/images/gophers/front.svg"}} {{$alt = "Go gopher"}} {{end}} @@ -37,11 +37,11 @@ {{$src = "/images/gophers/green.svg"}} {{$alt = "Go gopher"}} {{end}} -{{if or (eq $gopher "grey") (eq $gopher "gray")}} +{{if eq $gopher "grey" "gray"}} {{$src = "/images/gophers/grey.svg"}} {{$alt = "Go gopher"}} {{end}} -{{if (eq $gopher "happy") (eq $gopher "sticker2")}} +{{if eq $gopher "happy" "sticker2"}} {{$src = "/images/gophers/happy.svg"}} {{$alt = "Go gopher"}} {{end}} |
