prefetch sites on hovering their links in navbar

This commit is contained in:
2024-10-24 00:39:17 +02:00
parent 998d56e2e7
commit 8afd44ff49
3 changed files with 9 additions and 7 deletions
+4 -4
View File
@@ -75,9 +75,9 @@ const { current = '' } = Astro.props;
<nav>
<div class="nav-buttons">
<a class={current === "" ? "selected" : ""} href='/'>home</a>
<a class={current === "about" ? "selected" : ""} href='/about'>about</a>
<a class={current === "projects" ? "selected" : ""} href='/projects'>projects</a>
<a class={current === "blog" ? "selected" : ""} href='/blog'>blog</a>
<a data-astro-prefetch class={current === "" ? "selected" : ""} href='/'>home</a>
<a data-astro-prefetch class={current === "about" ? "selected" : ""} href='/about'>about</a>
<a data-astro-prefetch class={current === "projects" ? "selected" : ""} href='/projects'>projects</a>
<a data-astro-prefetch class={current === "blog" ? "selected" : ""} href='/blog'>blog</a>
</div>
</nav>
+1 -1
View File
@@ -21,7 +21,7 @@ const allPosts= posts.sort((a, b) => new Date(b.data.publishDate).valueOf() - ne
{ index !== 0 && <hr /> }
<div class="post-item">
<h2>
<a href={href}>{post.data.title}</a>
<a data-astro-prefetch href={href}>{post.data.title}</a>
</h2>
<div class="tags">
{post.data.tags.map(item => (