I want some scripts to appear in more than one section but in single pages only. The code below does not work. Which is the correct way to do it?
{{- if and (.IsPage) (eq .Section "foo") (eq .Section "bar")}}
{{- if and (.IsPage) (or (eq .Section "foo") (eq .Section "bar")) }}
less messy:
{{- $sections := slice "foo" "bar" -}}
{{- if and (.IsPage) (in $sections .Section) }}
...
{{- end -}}
1 Like
I was so close until I saw your answer. Just had to replace the second βandβ in my code with βorβ. Thanks.
Second option is definitely better, but the first is easier to understand. I will use the second.
1 Like
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.