prefetch all links

Signed-off-by: Max Schmidt <max.schmidt@outlook.de>
This commit is contained in:
Max Schmidt 2023-08-15 21:10:50 +02:00
parent 5ac061ca7d
commit 7bd3a6f06a
2 changed files with 4 additions and 1 deletions

View File

@ -21,6 +21,9 @@ export default defineConfig({
image({
serviceEntryPoint: "@astrojs/image/sharp",
}),
prefetch({
selector: "a",
}),
sitemap(),
prefetch(),
],

View File

@ -25,7 +25,7 @@ const posts = await getPosts();
{
posts.length > 0 ? (
posts.map((post) => (
<a href={`/posts/${post.id}/`} rel="prefetch">
<a href={`/posts/${post.id}/`}>
<article class="text-gray bg-gray-light px-5 py-3 rounded-md shadow-md w-64 text-center hover:-translate-y-1 transition-transform">
<h3 class="font-bold text-lg" transition:name=`title-${post.id}`>{post.title}</h3>
{post.publishedDate && (