Skip to content

Commit f5e738d

Browse files
committed
feat(docs): enhance caching and loading
1 parent 1d64024 commit f5e738d

File tree

9 files changed

+25
-7
lines changed

9 files changed

+25
-7
lines changed

docs/astro.config.mjs

+9
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,13 @@ import playformCompress from "@playform/compress";
88
export default defineConfig({
99
integrations: [tailwind(), playformCompress()],
1010
site: "https://blankie.rest",
11+
server: {
12+
headers: {
13+
// Set cache-control headers for all static assets
14+
"/*.{js,css,jpg,jpeg,png,gif,ico,svg,webp,mp4}":
15+
"Cache-Control: public, max-age=31536000, immutable", // 1 year cache
16+
// Specific headers for HTML files
17+
"/*.html": "Cache-Control: public, max-age=3600", // 1 hour cache
18+
},
19+
},
1120
});
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

docs/src/components/Nav.astro

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ const currentPath = Astro.url.pathname;
1919
alt="The Blankie app icon, which looks like a folded yellow blanket with one corner flipped over"
2020
width={40}
2121
height={33}
22+
loading="eager"
2223
class="h-10 w-10 object-contain"
2324
style={{ aspectRatio: "802/666" }}
2425
/>

docs/src/layouts/Layout.astro

+12-6
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ import Nav from "@/components/Nav.astro";
44
import Footer from "@/components/Footer.astro";
55
import "@/styles/global.scss";
66
7+
import favicon from "../assets/favicon.ico";
8+
import favicon16 from "../assets/favicon-16.png";
9+
import favicon32 from "../assets/favicon-32.png";
10+
import favicon48 from "../assets/favicon-48.png";
11+
import socialImage from "../assets/social.png";
12+
713
interface Props {
814
title: string;
915
}
@@ -24,10 +30,10 @@ const description = "Ambient sound mixer for macOS.";
2430
content="default-src 'self'; img-src 'self' data: https:; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline';"
2531
/>
2632

27-
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
28-
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16.png" />
29-
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32.png" />
30-
<link rel="icon" type="image/png" sizes="48x48" href="/favicon-48.png" />
33+
<link rel="icon" type="image/x-icon" href={favicon} />
34+
<link rel="icon" type="image/png" sizes="16x16" href={favicon16.src} />
35+
<link rel="icon" type="image/png" sizes="32x32" href={favicon32.src} />
36+
<link rel="icon" type="image/png" sizes="48x48" href={favicon48.src} />
3137

3238
<SEO
3339
title={`Blankie - ${title}`}
@@ -36,7 +42,7 @@ const description = "Ambient sound mixer for macOS.";
3642
basic: {
3743
title: `Blankie - ${title}`,
3844
type: "website",
39-
image: `${siteUrl}/social.png`,
45+
image: socialImage.src,
4046
url: `${siteUrl}${Astro.url.pathname}`,
4147
},
4248
image: {
@@ -55,7 +61,7 @@ const description = "Ambient sound mixer for macOS.";
5561
site: "@blankie",
5662
title: `Blankie - ${title}`,
5763
description: description,
58-
image: `${siteUrl}/social.png`,
64+
image: socialImage.src,
5965
}}
6066
/>
6167
</head>

docs/src/pages/index.astro

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import Layout from "../layouts/Layout.astro";
33
import { Image } from "astro:assets";
44
import screenshot from "../assets/screenshot.png";
5+
import wavesVideo from "../assets/waves.mp4";
56
67
const title = "Ambient sound mixer for macOS";
78
---
@@ -19,7 +20,7 @@ const title = "Ambient sound mixer for macOS";
1920
playsinline
2021
class="absolute top-1/2 left-1/2 min-w-full min-h-full -translate-x-1/2 -translate-y-1/2 object-cover opacity-40"
2122
>
22-
<source src="waves.mp4" type="video/mp4" />
23+
<source src={wavesVideo} type="video/mp4" />
2324
</video>
2425
</div>
2526
<div class="relative z-10 max-w-4xl mx-auto px-5 text-center py-16 mt-16">
@@ -46,6 +47,7 @@ const title = "Ambient sound mixer for macOS";
4647
alt="Screenshot of the Blankie app"
4748
width={730}
4849
height={1017}
50+
loading="eager"
4951
class="rounded-lg mx-auto max-w-full block transition duration-300 hover:scale-102 w-full md:w-[600px]"
5052
quality={90}
5153
style={{ aspectRatio: "730/1017" }}

0 commit comments

Comments
 (0)