Theme: Fix robots partial "isset on nil" warning
All checks were successful
/ build (pull_request) Successful in 40s
/ cleanup-staging (pull_request) Successful in 1s
/ build (push) Successful in 12s

As not all pages have the robots param defined, we got a warning:
WARN  calling IsSet with unsupported type "invalid" (<nil>) will always return false.
This is solved by adding an additional "isset" check.
This commit is contained in:
jtbx 2024-04-17 20:21:22 +02:00 committed by christian
parent e0c46fb4e2
commit 63d3f4459d

View file

@ -1,5 +1,5 @@
{{ $robotsGenerate := false -}} {{ $robotsGenerate := false -}}
{{- if or (isset $.Params.robots "index") (isset $.Params.robots "follow") }} {{- if and (isset $.Params "robots") (or (isset $.Params.robots "index") (isset $.Params.robots "follow")) }}
{{- $robotsGenerate = true -}} {{- $robotsGenerate = true -}}
{{- else if or (isset $.Site.Params.robots "index") (isset $.Site.Params.robots "follow") -}} {{- else if or (isset $.Site.Params.robots "index") (isset $.Site.Params.robots "follow") -}}
{{- $robotsGenerate = true -}} {{- $robotsGenerate = true -}}