{% capture imagePath %}/assets/blog/{{ page.id | split: "/" | last }}/{{ include.name }}{% endcapture %}

{% assign imagePath=(imagePath | relative_url) %}

{% capture src %}src="{{ imagePath }}"{% endcapture %}

{% assign caption=include.caption | default: "" %}
{% assign alt=include.alt | default: caption %}

{% if alt != blank %}
	{% capture alt %}alt="{{ alt }}" title="{{ alt }}"{% endcapture %}
{% endif %}

{% assign frame=include.frame %}
{% if frame == blank %}
	{% assign frame=true %}
{% endif %}

{% if include.width != blank %}
	{% capture width %}style="width:{{ include.width }}"{% endcapture %}
{% endif %}

<figure {{width}} class="figure {% if include.caption %}caption{% endif %} {% if frame %}frame{% endif %}">
	<a target="_blank" href="{{ imagePath }}"><img {{ src }} {{ alt }} /></a>
	{% if caption != blank %}<figcaption>{{ caption }}</figcaption>{% endif %}
</figure>