{% if include.post.categories %} {% if include.post.categories.size == 1 %} {{ include.post.categories.first | capitalize }}. {% else %} {% assign penultimate = include.post.categories.size | minus: 2 %} {% for i in (0..penultimate) %} {% if include.post.categories.size == 2 %} {{ include.post.categories[i] | capitalize }} {% else %} {{ include.post.categories[i] | capitalize }}, {% endif %} {% endfor %} and {{ include.post.categories.last | capitalize }}. {% endif %} {% endif %}