Skip to content

Commit 7744109

Browse files
committed
feat: preloaded placeholder image
1 parent 0bffd52 commit 7744109

File tree

5 files changed

+12
-0
lines changed

5 files changed

+12
-0
lines changed

public/previewplaceholder.webp

2.74 KB
Loading

src/components/BaseHead.astro

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ const { title, description, image } = Astro.props;
6060
<meta property="twitter:description" content={description} />
6161
<meta property="twitter:image" content={new URL(image, Astro.url)} />
6262

63+
<!-- Placeholder preloading -->
64+
<link rel="preload" href="/previewplaceholder.webp" as="image" />
65+
6366
<!-- Fix theme FOUC -->
6467
<script is:inline>
6568
// This must be inline to stop FOUC

src/components/PostPreview.astro

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ const post = Astro.props;
3535
aspect-ratio: 2 / 1;
3636
border-radius: var(--pico-border-radius);
3737
box-shadow: 0 0 4px rgb(from var(--pico-muted-color) r g b / 40%);
38+
background-image: url("/previewplaceholder.webp");
39+
background-size: cover;
40+
background-position: center;
3841
}
3942
.hero-image:not(:has(img)) {
4043
display: grid;

src/components/ToolList.astro

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,9 @@ const images = import.meta.glob("@/images/*");
110110
aspect-ratio: 2 / 1;
111111
border-radius: var(--pico-border-radius);
112112
box-shadow: 0 0 4px rgb(from var(--pico-muted-color) r g b / 40%);
113+
background-image: url("/previewplaceholder.webp");
114+
background-size: cover;
115+
background-position: center;
113116
}
114117
.hero-image:not(:has(img)) {
115118
display: grid;

src/layouts/BlogPost.astro

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@ const titlePrefixed = `FireIsBlog - ${title}`;
6262
<style>
6363
.cover {
6464
margin-bottom: var(--pico-spacing);
65+
background-image: url("/previewplaceholder.webp");
66+
background-size: cover;
67+
background-position: center;
6568
}
6669
.cover img {
6770
max-height: 80vh;

0 commit comments

Comments
 (0)