If/Not Statement with Multiple Conditions

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.

Try:

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

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

I edited the snippet to include additional parentheses

It worked - thanks!