Skip to content

Commit 7620b09

Browse files
authored
Merge pull request #1978 from hangy/optimize-landing-page-images
perf: Optimize landing page images
2 parents 23a6523 + 5bb2f9f commit 7620b09

File tree

7 files changed

+36
-17
lines changed

7 files changed

+36
-17
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
* text eol=lf
33

44
# These files are binary and should be left untouched
5+
*.avif binary
56
*.png binary
67
*.jpg binary
78
*.jpeg binary
278 KB
Binary file not shown.
204 KB
Binary file not shown.
201 KB
Binary file not shown.
174 KB
Binary file not shown.
134 KB
Binary file not shown.

wger/software/templates/features.html

Lines changed: 35 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,12 @@
9898
<section
9999
class="row px-3 mb-5 d-flex align-items-center justify-content-center gap-2 flex-row-reverse">
100100
<div class="col-lg-7 col-sm-6 col-12 d-flex px-5 flex-column align-items-center">
101-
<img src="{% static 'images/hero.png' %}"
102-
alt="a man with a dumbbell"
103-
class="header-hero-image">
101+
<picture>
102+
<source srcset="{% static 'images/hero.avif' %}" type="image/avif">
103+
<img src="{% static 'images/hero.png' %}"
104+
alt="a man with a dumbbell"
105+
class="header-hero-image">
106+
</picture>
104107
</div>
105108
<div class="col-lg-3 col-sm-5 col-11 d-flex py-3 flex-column align-items-start">
106109
<h1 class="font-bebas-neue display-3 uppercase">
@@ -155,9 +158,13 @@ <h2 class="display-3 font-bebas-neue text-dark-blue mb-0">{{ nr_stars }}+</h2>
155158
class="row row-cols row-cols-lg-2 row-cols-sm-1 px-3 w-100 justify-content-center flex-reverse gy-3">
156159
<div
157160
class="col-lg-7 col-sm-12 d-flex flex-column justify-content-center align-items-center position-relative">
158-
<img src="{% static 'images/screens-1.png' %}"
159-
alt="mobile screen showing wger feature"
160-
class="img-fluid">
161+
<picture>
162+
<source srcset="{% static 'images/screens-1.avif' %}" type="image/avif">
163+
<img src="{% static 'images/screens-1.png' %}"
164+
alt="mobile screen showing wger feature"
165+
class="img-fluid"
166+
loading="lazy">
167+
</picture>
161168
</div>
162169

163170
<div
@@ -190,9 +197,13 @@ <h2 class="w-100 font-bebas-neue display-4 uppercase header-workout">
190197
<div
191198
class="col-lg-7 col-sm-12 d-flex flex-column justify-content-center align-items-center position-relative"
192199
style="overflow: hidden;">
193-
<img src="{% static 'images/screens-2.png' %}"
194-
alt="mobile screen showing wger feature"
195-
class="img-fluid">
200+
<picture>
201+
<source srcset="{% static 'images/screens-2.avif' %}" type="image/avif">
202+
<img src="{% static 'images/screens-2.png' %}"
203+
alt="mobile screen showing wger feature"
204+
class="img-fluid"
205+
loading="lazy">
206+
</picture>
196207
</div>
197208
<div
198209
class="col-lg-5 col-sm-12 d-flex flex-column align-items-start justify-content-center">
@@ -226,10 +237,13 @@ <h2 class="w-100 font-bebas-neue display-4 uppercase header-meals">
226237
<div
227238
class="col-lg-7 col-sm-12 d-flex flex-column justify-content-center align-items-center position-relative"
228239
style="overflow: hidden;">
229-
<img src="{% static 'images/screens-3.png' %}"
230-
alt="mobile screen showing wger feature"
231-
class="img-fluid">
232-
240+
<picture>
241+
<source srcset="{% static 'images/screens-3.avif' %}" type="image/avif">
242+
<img src="{% static 'images/screens-3.png' %}"
243+
alt="mobile screen showing wger feature"
244+
class="img-fluid"
245+
loading="lazy">
246+
</picture>
233247
</div>
234248
<div
235249
class="col-lg-5 col-sm-12 d-flex flex-column align-items-start justify-content-center py-2">
@@ -280,10 +294,14 @@ <h2 class="w-100 font-bebas-neue display-4 uppercase w-100 header-progress">
280294
<div class="row w-100 gy-3">
281295
<div
282296
class="col-lg-7 col-sm-12 d-flex flex-column justify-content-center align-items-center">
283-
<img src="{% static 'images/community.png' %}"
284-
width="500"
285-
alt="list of human faces"
286-
class="img-fluid">
297+
<picture>
298+
<source srcset="{% static 'images/community.avif' %}" type="image/avif">
299+
<img src="{% static 'images/community.png' %}"
300+
width="500"
301+
alt="list of human faces"
302+
class="img-fluid"
303+
loading="lazy">
304+
</picture>
287305
</div>
288306
<div class="col-lg-5 col-sm-12">
289307
<h1 class="display-3 uppercase font-bebas-neue header-community">

0 commit comments

Comments
 (0)