2

I'm trying to use a conditional to do something if the first segment matches This or That. But I'm unable to come up with the right operator for the "or"

{% elseif craft.request.firstSegment == 'This' || 'That' %}

What's the proper operator here? Thanks!

1 Answer 1

12

You want:

{% if craft.request.firstSegment == 'This' or craft.request.firstSegment == 'That' %}

or this would work:

{% if craft.request.firstSegment in ['This', 'That'] %}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.