{% if page.type == “post” %} {% capture imagePath %}{{ page.date | date: “%Y-%m-%d” }}-{{ page.title | slugify }}/{{ include.name }}{% endcapture %} {% capture directory %}posts{% endcapture %} {% elsif page.type == “project” %} {% capture imagePath %}{{ page.title | slugify }}/{{ include.name }}{% endcapture %} {% capture directory %}projects{% endcapture %} {% endif %} {% if include.caption %} <figure {% if include.center %} class=“center” {% endif %}> <img src=“/assets/images/{{ directory }}/{{ imagePath }}” {% if include.alt %} alt=“{{ include.alt }}” {% endif %} /> <figcaption>{{ include.caption }}</figcaption> </figure> {% else %} <img src=“/assets/images/{{ directory }}/{{ imagePath }}” {% if include.alt %} alt=“{{ include.alt }}” {% endif %} {% if include.center %} class=“center” {% endif %} /> {% endif %}