|
1 |
| -{%- assign path = include.path | remove: ".jpg" | remove: ".jpeg" | remove: ".png" | remove: ".tiff" -%} |
| 1 | +{%- assign img_path = include.path | remove: ".jpg" | remove: ".jpeg" | remove: ".png" | remove: ".tiff" -%} |
2 | 2 |
|
3 | 3 | <figure>
|
4 | 4 |
|
5 | 5 | <picture>
|
6 |
| - {% if site.enable_responsive_images %} |
| 6 | + {% if site.imagemagick.enabled %} |
7 | 7 | {% for i in site.imagemagick.widths -%}
|
8 |
| - <source media="(max-width: {{ i }}px)" srcset="{{ path | relative_url }}-{{ i }}.webp" /> |
| 8 | + <source |
| 9 | + class="responsive-img-srcset" |
| 10 | + media="(max-width: {{ i }}px)" |
| 11 | + srcset="{{ img_path | relative_url }}-{{ i }}.webp" |
| 12 | + /> |
9 | 13 | {% endfor -%}
|
10 | 14 | {% endif %}
|
11 | 15 |
|
12 | 16 | <!-- Fallback to the original file -->
|
13 | 17 | <img
|
14 |
| - {% if include.class %}class="{{ include.class }}"{% endif %} |
15 |
| - src="{{ include.path | relative_url }}" |
16 |
| - {% if include.width %}width="{{ include.width }}"{% else %}width="auto"{% endif %} |
17 |
| - {% if include.height %}height="{{ include.height }}"{% else %}height="auto"{% endif %} |
18 |
| - {% if include.min-width %}min-width="{{ include.min-width }}"{% endif %} |
19 |
| - {% if include.min-height %}min-height="{{ include.min-height }}"{% endif %} |
20 |
| - {% if include.max-width %}max-width="{{ include.max-width }}"{% endif %} |
21 |
| - {% if include.max-height %}height="{{ include.max-height }}"{% endif %} |
22 |
| - {% if include.alt %}alt="{{ include.alt }}"{% endif %} |
23 |
| - {% if include.title %}title="{{ include.title }}"{% endif %} |
24 |
| - {% if include.zoomable %}data-zoomable{% endif %} /> |
| 18 | + src="{{ include.path | relative_url }}" |
| 19 | + {% if include.class %}class="{{ include.class }}"{% endif %} |
| 20 | + {% if include.width %}width="{{ include.width }}"{% else %}width="auto"{% endif %} |
| 21 | + {% if include.height %}height="{{ include.height }}"{% else %}height="auto"{% endif %} |
| 22 | + {% if include.min-width %}min-width="{{ include.min-width }}"{% endif %} |
| 23 | + {% if include.min-height %}min-height="{{ include.min-height }}"{% endif %} |
| 24 | + {% if include.max-width %}max-width="{{ include.max-width }}"{% endif %} |
| 25 | + {% if include.max-height %}height="{{ include.max-height }}"{% endif %} |
| 26 | + {% if include.alt %}alt="{{ include.alt }}"{% endif %} |
| 27 | + {% if include.title %}title="{{ include.title }}"{% endif %} |
| 28 | + {% if include.zoomable %}data-zoomable{% endif %} |
| 29 | + onerror="this.onerror=null; $('.responsive-img-srcset').remove();" |
| 30 | + /> |
25 | 31 |
|
26 | 32 | </picture>
|
27 | 33 |
|
|
0 commit comments