If/Not Statement with Multiple Conditions


#1

Having trouble getting this to work. I am trying to show a list of items not listed in 2 templates, my statement works, but is only reading the first ‘teacher’ statement.

{{ if not (in .template "teacher") | or (in .template "student") }}

I have also tried:

{{ if or (in .template "teacher") (in .template "student") }}

This reads both conditions but excludes everything but these two templates, so works but in the opposite way. I tried adding in a (not in .template "teacher") but get a hugo build error.


#2

Try:

{{ if and (not (in .template "teacher")) (not (in .template "student")) }}

#3

Hmm. I tried the statement, but got a Hugo error
execute of template failed: template: member/single.html:69:15: executing "main" at <not>: wrong number of args for not: want 1 got 3


#4

I edited the snippet to include additional parentheses


#5

It worked - thanks!