summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIwanIDev <iwan@iwani.dev>2026-03-27 10:13:21 +0000
committerIwanIDev <iwan@iwani.dev>2026-03-27 10:13:21 +0000
commit8b74051bf58f48cbdd1c80e9b130e51b0702a725 (patch)
tree46137bbb62393276e07c25ea345202099a77e026
parent5667edaf906f289e84ac52daf6464f8ba046dbc7 (diff)
feat: enabled prefetch on blog posts
-rw-r--r--astro.config.mjs1
-rw-r--r--src/components/BlogPosts.astro4
2 files changed, 3 insertions, 2 deletions
diff --git a/astro.config.mjs b/astro.config.mjs
index 00bde21..2d50471 100644
--- a/astro.config.mjs
+++ b/astro.config.mjs
@@ -10,4 +10,5 @@ export default defineConfig({
plugins: [tailwindcss()],
},
integrations: [react()],
+ prefetch: true,
})
diff --git a/src/components/BlogPosts.astro b/src/components/BlogPosts.astro
index 9101e38..5a66a89 100644
--- a/src/components/BlogPosts.astro
+++ b/src/components/BlogPosts.astro
@@ -21,7 +21,7 @@ const dateFormatter = new Intl.DateTimeFormat('en-GB', {
<h1 class="text-3xl font-bold mb-8">Blog Posts</h1>
<div class="space-y-4 max-h-96 overflow-y-auto">
{sortedPosts.map((post) => (
- <a href={`/posts/${post.id}`} class="block hover:opacity-80 transition-opacity">
+ <a href={`/posts/${post.id}`} class="block hover:opacity-80 transition-opacity" data-astro-prefetch>
<Card>
<CardHeader>
<h2 class="font-heading text-sm font-medium" transition:name={`post-title-${post.id}`}>{post.data.title}</h2>
@@ -37,4 +37,4 @@ const dateFormatter = new Intl.DateTimeFormat('en-GB', {
</a>
))}
</div>
-</div> \ No newline at end of file
+</div>