further tweaks to image include

This commit is contained in:
rzen
2020-05-31 16:26:49 -04:00
parent 9f2a61fb47
commit a2446d666c
2 changed files with 23 additions and 15 deletions

View File

@ -1,17 +1,21 @@
{% capture imagePath %}{{ page.id | split: "/" | last }}/{{ include.name }}{% endcapture %}
{% capture imagePath %}/assets/blog/{{ page.id | split: "/" | last }}/{{ include.name }}{% endcapture %}
{% if include.frame == false %}
{% assign frame = false %}
{% else %}
{% assign frame = true %}
{% capture src %}src="{{ imagePath }}"{% endcapture %}
{% assign alt=include.alt | default: "" %}
{% if alt != blank %}
{% capture alt %}alt="{{ include.alt }}" title="{{ include.alt}}"{% endcapture %}
{% endif %}
<figure class="figure {% if include.caption %}figure-caption{% endif %} {% if frame %}figure--frame{% endif %}">
<div class="figure__inner">
<img Xwidth="100%" class="figure__image" src="/assets/blog/{{ imagePath }}" {% if include.alt %} alt="{{ include.alt }}" {% endif %} {% if include.width %} width="{{ include.width }}" {% endif %}/>
{% if include.caption %}
<figcaption class="figure__caption">{{ include.caption }} {% if include.source %}<a class="source" href="{{ include.source }}" title="{{ include.source }}">Source</a>.{% endif %}</figcaption>
{% endif %}
</div>
{% assign caption=include.caption | default: "" %}
{% if alt == blank and caption != blank %}
{% assign alt=caption %}
{% endif %}
{% assign frame=include.frame | default: true %}
<figure class="figure {% if include.caption %}caption{% endif %} {% if frame %}frame{% endif %}">
<a target="_blank" href="{{ imagePath }}"><img {{ src }} {{ alt }} width="100%" /></a>
{% if caption != blank %}<figcaption>{{ caption }}</figcaption>{% endif %}
</figure>