Enabled prefetching of pages
This commit is contained in:
parent
45e48dc631
commit
7704751367
3 changed files with 6 additions and 3 deletions
|
|
@ -5,6 +5,7 @@ import compressor from 'astro-compressor'
|
||||||
import robotsTxt from '@itsmatteomanf/astro-robots-txt'
|
import robotsTxt from '@itsmatteomanf/astro-robots-txt'
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
|
prefetch: true,
|
||||||
integrations: [solidJs(), compressor({ gzip: false, brotli: true }), robotsTxt()],
|
integrations: [solidJs(), compressor({ gzip: false, brotli: true }), robotsTxt()],
|
||||||
vite: {
|
vite: {
|
||||||
css: {
|
css: {
|
||||||
|
|
|
||||||
|
|
@ -31,14 +31,14 @@ export default (props: Props) => {
|
||||||
<Show when={props.to}>
|
<Show when={props.to}>
|
||||||
<Switch>
|
<Switch>
|
||||||
<Match when={props.design}>
|
<Match when={props.design}>
|
||||||
<a href={props.to} aria-label={props.label}>
|
<a href={props.to} aria-label={props.label} data-astro-prefetch>
|
||||||
<button class={props.design} style={borderRadius}>
|
<button class={props.design} style={borderRadius}>
|
||||||
{props.label || 'Click Me!'}
|
{props.label || 'Click Me!'}
|
||||||
</button>
|
</button>
|
||||||
</a>
|
</a>
|
||||||
</Match>
|
</Match>
|
||||||
<Match when={!props.design}>
|
<Match when={!props.design}>
|
||||||
<a href={props.to} aria-label={props.label}>
|
<a href={props.to} aria-label={props.label} data-astro-prefetch>
|
||||||
<button class="button" style={borderRadius}>
|
<button class="button" style={borderRadius}>
|
||||||
{props.label || 'Click Me!'}
|
{props.label || 'Click Me!'}
|
||||||
</button>
|
</button>
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
// import { prefetch } from 'astro:prefetch'
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
to: string
|
to: string
|
||||||
children?: any
|
children?: any
|
||||||
|
|
@ -6,7 +8,7 @@ interface Props {
|
||||||
export default (props: Props) => {
|
export default (props: Props) => {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<a href={props.to} aria-label={`Go to ${props.to}`}>
|
<a href={props.to} aria-label={`Go to ${props.to}`} data-astro-prefetch>
|
||||||
{props.children}
|
{props.children}
|
||||||
</a>
|
</a>
|
||||||
</>
|
</>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue