* Use relative_url and absolute_url where possible Drops the `contains "://"` check, adopt Jekyll 3.7 Ref: https://github.com/mmistakes/minimal-mistakes/pull/2385#issuecomment-579882236 * One more unneeded {% assign %} * Remove one more assign as noted by mmistakes * Consolidate 4 more captures * Consolidate an extra assign on "active" class
36 lines
1.1 KiB
Text
36 lines
1.1 KiB
Text
{% if include.id %}
|
|
{% assign gallery = page[include.id] %}
|
|
{% else %}
|
|
{% assign gallery = page.gallery %}
|
|
{% endif %}
|
|
|
|
{% if include.layout %}
|
|
{% assign gallery_layout = include.layout %}
|
|
{% else %}
|
|
{% if gallery.size == 2 %}
|
|
{% assign gallery_layout = 'half' %}
|
|
{% elsif gallery.size >= 3 %}
|
|
{% assign gallery_layout = 'third' %}
|
|
{% else %}
|
|
{% assign gallery_layout = '' %}
|
|
{% endif %}
|
|
{% endif %}
|
|
|
|
<figure class="{{ gallery_layout }} {{ include.class }}">
|
|
{% for img in gallery %}
|
|
{% if img.url %}
|
|
<a href="{{ img.url | relative_url }}"
|
|
{% if img.title %}title="{{ img.title }}"{% endif %}>
|
|
<img src="{{ img.image_path | relative_url }}"
|
|
alt="{% if img.alt %}{{ img.alt }}{% endif %}">
|
|
</a>
|
|
{% else %}
|
|
<img src="{{ img.image_path | relative_url }}"
|
|
alt="{% if img.alt %}{{ img.alt }}{% endif %}">
|
|
{% endif %}
|
|
{% endfor %}
|
|
{% if include.caption %}
|
|
<figcaption>{{ include.caption | markdownify | remove: "<p>" | remove: "</p>" }}</figcaption>
|
|
{% endif %}
|
|
</figure>
|