Skip to content

Commit d0c0c3c

Browse files
committed
fix: describe optimized images explicitly
Nuxt Image renders native img attributes and documents that alt should always be provided. Deployment logos carry information, so the logo image gets an explicit label. Nuxt Image also generates responsive candidates from the sizes option. The video-course logos are fixed-size images, so the sizes value now matches the actual sponsor/non-sponsor rendered width instead of forcing a wider candidate for every course. Docs: https://image.nuxt.com/usage/nuxt-img#alt Docs: https://image.nuxt.com/usage/nuxt-img#sizes
1 parent 74f6905 commit d0c0c3c

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

app/pages/deploy/index.vue

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,14 @@ await fetchList()
6262
}"
6363
>
6464
<template #leading>
65-
<NuxtImg v-if="deployment.logoSrc" :src="deployment.logoSrc" width="40" height="40" class="w-10 h-10" />
65+
<NuxtImg
66+
v-if="deployment.logoSrc"
67+
:src="deployment.logoSrc"
68+
:alt="`${deployment.title} logo`"
69+
width="40"
70+
height="40"
71+
class="w-10 h-10"
72+
/>
6673
<UIcon v-else :name="deployment.logoIcon" class="size-10 text-black dark:text-white" />
6774
</template>
6875
<UBadge

app/pages/video-courses.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ defineOgImage('Docs.takumi', {
4545
:alt="course.name"
4646
:width="'sponsor' in course && course.sponsor ? 94 : 56"
4747
:height="'sponsor' in course && course.sponsor ? 47 : 28"
48+
:sizes="'sponsor' in course && course.sponsor ? '94px' : '56px'"
4849
format="webp"
4950
:modifiers="{ position: 'top' }"
5051
:loading="index > 3 ? 'lazy' : undefined"

0 commit comments

Comments
 (0)