Skip to content

Commit 073ee07

Browse files
committed
Updat epubs
1 parent 50afa47 commit 073ee07

1 file changed

Lines changed: 12 additions & 10 deletions

File tree

_includes/responsive_image.liquid

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,26 @@
33
{% endcomment %}
44

55
{% assign image_path = include.path %}
6-
{% assign image_alt = include.alt | default: "" %}
7-
{% assign image_class = include.class | default: "" %}
6+
{% assign image_alt = include.alt | default: '' %}
7+
{% assign image_class = include.class | default: '' %}
88

99
{% comment %} Extract base path without extension {% endcomment %}
1010
{% assign path_parts = image_path | split: '.' %}
1111
{% assign extension = path_parts | last %}
12-
{% assign path_without_ext = image_path | replace_last: extension, "" | remove_last: "." %}
12+
{% assign path_without_ext = image_path | replace_last: extension, '' | remove_last: '.' %}
1313

1414
<picture>
1515
{% comment %} WebP sources with different widths {% endcomment %}
16-
<source
16+
<source
1717
type="image/webp"
18-
srcset="{{ path_without_ext }}-480.webp 480w,
19-
{{ path_without_ext }}-800.webp 800w,
20-
{{ path_without_ext }}-1400.webp 1400w"
21-
sizes="(max-width: 480px) 480px, (max-width: 800px) 800px, 1400px">
22-
18+
srcset="
19+
{{ path_without_ext }}-480.webp 480w,
20+
{{ path_without_ext }}-800.webp 800w,
21+
{{ path_without_ext }}-1400.webp 1400w
22+
"
23+
sizes="(max-width: 480px) 480px, (max-width: 800px) 800px, 1400px"
24+
>
25+
2326
{% comment %} Fallback to original image {% endcomment %}
2427
<img src="{{ image_path }}" alt="{{ image_alt }}" class="{{ image_class }}" loading="lazy">
2528
</picture>
26-

0 commit comments

Comments
 (0)