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 %}
You can either use else if
or elsif
.elseif
is wrong and will throw an error.