mirror of
https://github.com/YouHaveTrouble/youhavetrouble.github.io.git
synced 2026-05-11 22:06:56 +00:00
prefetch sites on hovering their links in navbar
This commit is contained in:
+4
-2
@@ -1,5 +1,4 @@
|
|||||||
import { defineConfig } from 'astro/config'
|
import { defineConfig } from 'astro/config'
|
||||||
import svelte from '@astrojs/svelte'
|
|
||||||
import mdx from '@astrojs/mdx'
|
import mdx from '@astrojs/mdx'
|
||||||
import remarkGfm from 'remark-gfm'
|
import remarkGfm from 'remark-gfm'
|
||||||
import remarkSmartypants from 'remark-smartypants'
|
import remarkSmartypants from 'remark-smartypants'
|
||||||
@@ -8,7 +7,10 @@ import rehypeExternalLinks from 'rehype-external-links'
|
|||||||
// https://astro.build/config
|
// https://astro.build/config
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
site: 'https://youhavetrouble.me',
|
site: 'https://youhavetrouble.me',
|
||||||
integrations: [mdx(), svelte()],
|
prefetch: {
|
||||||
|
defaultStrategy: 'hover',
|
||||||
|
},
|
||||||
|
integrations: [mdx()],
|
||||||
markdown: {
|
markdown: {
|
||||||
shikiConfig: {
|
shikiConfig: {
|
||||||
theme: 'nord',
|
theme: 'nord',
|
||||||
|
|||||||
@@ -75,9 +75,9 @@ const { current = '' } = Astro.props;
|
|||||||
|
|
||||||
<nav>
|
<nav>
|
||||||
<div class="nav-buttons">
|
<div class="nav-buttons">
|
||||||
<a class={current === "" ? "selected" : ""} href='/'>home</a>
|
<a data-astro-prefetch class={current === "" ? "selected" : ""} href='/'>home</a>
|
||||||
<a class={current === "about" ? "selected" : ""} href='/about'>about</a>
|
<a data-astro-prefetch class={current === "about" ? "selected" : ""} href='/about'>about</a>
|
||||||
<a class={current === "projects" ? "selected" : ""} href='/projects'>projects</a>
|
<a data-astro-prefetch class={current === "projects" ? "selected" : ""} href='/projects'>projects</a>
|
||||||
<a class={current === "blog" ? "selected" : ""} href='/blog'>blog</a>
|
<a data-astro-prefetch class={current === "blog" ? "selected" : ""} href='/blog'>blog</a>
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ const allPosts= posts.sort((a, b) => new Date(b.data.publishDate).valueOf() - ne
|
|||||||
{ index !== 0 && <hr /> }
|
{ index !== 0 && <hr /> }
|
||||||
<div class="post-item">
|
<div class="post-item">
|
||||||
<h2>
|
<h2>
|
||||||
<a href={href}>{post.data.title}</a>
|
<a data-astro-prefetch href={href}>{post.data.title}</a>
|
||||||
</h2>
|
</h2>
|
||||||
<div class="tags">
|
<div class="tags">
|
||||||
{post.data.tags.map(item => (
|
{post.data.tags.map(item => (
|
||||||
|
|||||||
Reference in New Issue
Block a user