Skip to content

Commit e14ff2e

Browse files
committed
Optimize page LCP
1 parent e71d9b4 commit e14ff2e

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

Diff for: src/components/PreviewList.astro

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ const { contentItems, largeImages = false } = Astro.props;
1111
src={contentItem.cover}
1212
srcset={contentItem.coverSrcset}
1313
alt=''
14-
height={largeImages ? '300' : '200'}
15-
width='400'
14+
height={largeImages ? '240' : '180'}
15+
width='360'
1616
loading='lazy'
1717
/>
1818
<article>

Diff for: src/styles/components/_hero.scss

+5
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@
2222
img {
2323
border-radius: var(--border-radius-medium);
2424

25+
// Optimize image for LCP, by defining a height and aspect ratio.
26+
height: 240px;
27+
aspect-ratio: 1;
28+
object-fit: cover;
29+
2530
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
2631
// Apply this effect only when hover is supported and the user has not
2732
// requested reduced motion. It's just for show, so it's not important.

0 commit comments

Comments
 (0)