Skip to content

Commit ab4bf3f

Browse files
committed
perf(img): Add loading and fetchpriority attributes to relevant images
1 parent 5913b5b commit ab4bf3f

5 files changed

Lines changed: 8 additions & 8 deletions

File tree

app/components/ArticleList.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<p v-if="props.suggested.titles.includes(item.title)" class="post__banner">Suggested</p>
1111
<picture class="post__img">
1212
<source :srcset="`${item.path}/cover_image.webp`" type="image/webp">
13-
<img :src="`${item.path}/cover_image.webp`" alt="" width="424" height="223" :loading="index <= props.preloadArticleImages ? 'eager' : 'lazy'" />
13+
<img :src="`${item.path}/cover_image.webp`" alt="" width="424" height="223" :loading="index <= props.preloadArticleImages ? 'eager' : 'lazy'" :fetchpriority="index <= props.preloadArticleImages ? 'high' : 'low'" />
1414
</picture>
1515
<div class="post__details">
1616
<ul class="post__tags">

app/components/ProjectList.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<component :is="project.isUrlDeactivated ? 'div' : defineNuxtLink({})" :to="project.isUrlDeactivated ? undefined : project.url" class="project" :target="project.isUrlDeactivated ? undefined : '_blank'">
55
<picture class="project__img">
66
<source :srcset="project.image" :type="`image/${project.image.split('.').pop()}`">
7-
<img :src="project.image" alt="" width="424" height="223" :loading="index <= props.preloadProjectImages ? 'eager' : 'lazy'" />
7+
<img :src="project.image" alt="" width="424" height="223" :loading="index <= props.preloadProjectImages ? 'eager' : 'lazy'" :fetchpriority="index <= props.preloadProjectImages ? 'high' : 'low'" />
88
</picture>
99
<div class="project__details">
1010
<ul class="project__tags">

app/pages/blog/[year]/[slug].vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
</header>
77
<picture class="article__img">
88
<source :srcset="cover_image" type="image/webp">
9-
<img :src="cover_image" alt="" width="768" height="403" loading="eager" />
9+
<img :src="cover_image" alt="" width="768" height="403" loading="eager" fetchpriority="high" />
1010
</picture>
1111
<ul class="article__tags">
1212
<li v-for="tag in article.tags" :key="tag" class="tag">

app/pages/index.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<div class="hero__row">
66
<picture class="hero__img">
77
<source srcset="/me.webp" type="image/webp">
8-
<img src="/me.webp" alt="Jack Domleo portrait" height="300" width="300" loading="eager" />
8+
<img src="/me.webp" alt="Jack Domleo portrait" height="300" width="300" loading="eager" fetchpriority="high" />
99
</picture>
1010
<h1 class="hero__title">Jack Domleo</h1>
1111
</div>
@@ -17,7 +17,7 @@
1717
<div class="about__img">
1818
<picture>
1919
<source srcset="/me.webp" type="image/webp">
20-
<img src="/me.webp" alt="Jack Domleo portrait" height="440" width="440" loading="lazy" />
20+
<img src="/me.webp" alt="Jack Domleo portrait" height="440" width="440" loading="lazy" fetchpriority="low" />
2121
</picture>
2222
</div>
2323
<h2 class="about__header">About me</h2>

app/pages/work.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<ol class="work__places">
99
<li class="place">
1010
<div class="place__details">
11-
<img src="/work/ocean-finance-logo.webp" alt="Ocean Finance" height="80" width="80" class="place__logo" />
11+
<img src="/work/ocean-finance-logo.webp" alt="Ocean Finance" height="80" width="80" class="place__logo" loading="eager" fetchpriority="high" />
1212
<h2 class="place__name">Ocean Finance</h2>
1313
<p class="place__duration">February 2021 - present</p>
1414
</div>
@@ -65,7 +65,7 @@
6565
</li>
6666
<li class="place">
6767
<div class="place__details">
68-
<img src="/work/mitrefinch-logo.webp" alt="Mitrefinch" height="80" width="80" class="place__logo" />
68+
<img src="/work/mitrefinch-logo.webp" alt="Mitrefinch" height="80" width="80" class="place__logo" loading="lazy" fetchpriority="low" />
6969
<h2 class="place__name">Mitrefinch</h2>
7070
<p class="place__duration">March 2019 - February 2021</p>
7171
</div>
@@ -117,7 +117,7 @@
117117
</li>
118118
<li class="place">
119119
<div class="place__details">
120-
<img src="/work/flybmi-logo.webp" alt="flybmi" height="80" width="80" class="place__logo" />
120+
<img src="/work/flybmi-logo.webp" alt="flybmi" height="80" width="80" class="place__logo" loading="lazy" fetchpriority="low" />
121121
<h2 class="place__name">flybmi</h2>
122122
<p class="place__duration">September 2018 - February 2019</p>
123123
</div>

0 commit comments

Comments
 (0)