Skip to content

Commit 1c4db58

Browse files
Optimise blog thumbnail images
1 parent 7c1d8c5 commit 1c4db58

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed
Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
import { Image } from 'astro:assets';
2+
import { Image } from "astro:assets";
33
44
export interface Props {
55
title: string;
@@ -9,8 +9,7 @@ export interface Props {
99
cover: ImageMetadata;
1010
coverAlt: string;
1111
}
12-
const { title, href, publishDate, description, cover, coverAlt } =
13-
Astro.props;
12+
const { title, href, publishDate, description, cover, coverAlt } = Astro.props;
1413
1514
const options: Intl.DateTimeFormatOptions = {
1615
weekday: "long",
@@ -20,8 +19,17 @@ const options: Intl.DateTimeFormatOptions = {
2019
};
2120
---
2221

23-
<a href=`/blog/${href}` class="col-span-12 sm:col-span-6 md:col-span-4 flex flex-col gap-4 hover:opacity-90 transition-opacity duration-200">
24-
<Image class="rounded-md aspect-image" alt={coverAlt} src={cover} />
22+
<a
23+
href=`/blog/${href}`
24+
class="col-span-12 sm:col-span-6 md:col-span-4 flex flex-col gap-4 hover:opacity-90 transition-opacity duration-200"
25+
>
26+
<Image
27+
width="800"
28+
quality="80"
29+
class="rounded-md aspect-image"
30+
alt={coverAlt}
31+
src={cover}
32+
/>
2533
<div class="flex flex-col gap-1">
2634
<small>{publishDate.toLocaleDateString("en-US", options)}</small>
2735
<h3>{title}</h3>
@@ -30,4 +38,4 @@ const options: Intl.DateTimeFormatOptions = {
3038
<p>
3139
{description.length > 200 ? `${description.slice(0, 200)}...` : description}
3240
</p>
33-
</a>
41+
</a>

0 commit comments

Comments
 (0)