How do I chain if statements in Jekyll?
In Jekyll/Liquid else-if is spelt elsif
, i.e.:
{% if page.type == "post" %}
{% include post.html %}
{% elsif page.class == "contact" %}
{% include contact.html %}
{% else %}
{{ content }}
{% endif %}
In Jekyll/Liquid else-if is spelt elsif
, i.e.:
{% if page.type == "post" %}
{% include post.html %}
{% elsif page.class == "contact" %}
{% include contact.html %}
{% else %}
{{ content }}
{% endif %}