We have recently refreshed our branding across our offerings and changed the names of our pricing plans. If you have signed up before Aug 9, 2021, please click Previous plans to view your applicable plans.
We assure you that this change will not impact your product experience, and no action is required on your part.
i. If/Else
The If-Else-Unless structure from the Liquid library allows you to branch HTML statements just like you would with a traditional programming language. It’s easy to implement and takes just a few steps.
The example below shows how you can create an If-Else structure to show different links to logged in and logged out users in the portal.
{% if portal.user %}
<a href="{{ portal.profile_url }}">Edit profile</a></span>
<a href="{{ portal.logout_url }}">Signout</a>
{% else %}
<a href="{{ portal.login_url }}">Login</a>
<a href="{{ portal.signup_url }}">Signup</a></span>
{% endif %}
ii. Cases:
Liquid Cases are similar to switch cases used in popular programming languages. It checks a single expression with multiple values and branches with different statements correspondingly.
{% case forum.type_name %}
{% when ‘announcement’ %}
<!-- Style for announcements forum -->
{% when ‘ideas’ %}
<!-- Style for Idea forums -->
{% when ‘questions’ %}
<!-- Style for questions forum -->
{% when ‘problems’ %}
<!-- Style for problems forum -->
{% else %}
<!-- Default forum style -->
{% endcase %}
Switch cases come in handy especially when you want to provide a different style based on the solution category or forum topic type.