{% assign name_dot_format = include.file | split: "." %} {% assign name = name_dot_format | first %} {% assign format = name_dot_format | last %} {% comment %} Let 'suffix' = last 4 chars of 'name', 'prefix' = the rest {% endcomment %} {% assign suffix = name | slice: -4, 4 %} {% assign rname = name | split: "" | reverse | join: "" %} {% assign rsuffix = suffix | split: "" | reverse | join: "" %} {% assign rprefix = rname | remove_first: rsuffix %} {% assign prefix = rprefix | split: "" | reverse | join: "" %} {% comment %} If 'name' ends in "full", half-size image must exist {% endcomment %} {% assign name_full = name %} {% if suffix == "full" %} {% assign name_half = prefix | append: "half" %} {% else %} {% assign name_half = name_full %} {% endif %} {% comment %} Insert the image, linking to the full-size version {% endcomment %}