How does the correct syntax for an 'if statement' work?

Hello

I can’t get this figured out, how does the syntax has to be to make it work?

Kevin-chili_0-1625577488167.png

Thanks in advance!

@Kevin-chili

To better assist other users, please provide more context on the end goal and what you’re trying to achieve. More context will be needed in order for other users to help with your question.

@Trevor

What I’m trying to achieve here is to get the current language iso which does work with the following code {{ request.path | slice: 1,2}} it does output the value “en”.

Now really simple, I just want to put that into a if statement and check if the value is equals to “en” and if so it outputs a link that switches the language.

But the problem is, that the syntax isn’t right and since I’m new to Liquid i don’t know how to put a statement like this into a if condition.

Unfortunately the Template I’ve purchased does not have the option to add the language selector into the mobile navigation so I’m trying to configure it myself.

Hopefully this will clear it up.

Please change code:
{% assign requestPath = request.path | slice: 1,2 %}
{% if requestPath == ‘en’ %}{% endif %}
Hope it helps!

1 Like

Thank you, I’ve figured it out in the end.