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!

11

You want:

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

or this would work:

{% if craft.request.firstSegment in ['This', 'That'] %}
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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