Use sveltekit-prefetch globally and update template
This commit is contained in:
@@ -13,8 +13,8 @@
|
||||
%sveltekit.head%
|
||||
</head>
|
||||
|
||||
<body>
|
||||
%sveltekit.body%
|
||||
<body data-sveltekit-prefetch>
|
||||
<div style="display: contents">%sveltekit.body%</div>
|
||||
|
||||
<script>
|
||||
document.body.style.opacity = '0'
|
||||
|
||||
@@ -11,9 +11,7 @@
|
||||
export let url: string
|
||||
</script>
|
||||
|
||||
<a href={url} class="box-cta"
|
||||
data-sveltekit-prefetch={url.includes('http') ? true : undefined}
|
||||
>
|
||||
<a href={url} class="box-cta">
|
||||
<div class="icon">
|
||||
<Icon icon={icon} label={alt} />
|
||||
</div>
|
||||
|
||||
@@ -44,7 +44,6 @@
|
||||
<a
|
||||
href={url} class={classes}
|
||||
{target} {rel}
|
||||
data-sveltekit-prefetch={url && (isExternal || isProtocol) ? 'off' : ''}
|
||||
data-sveltekit-noscroll={isExternal || isProtocol ? 'off' : ''}
|
||||
{disabled}
|
||||
tabindex="0"
|
||||
|
||||
@@ -65,7 +65,7 @@
|
||||
|
||||
<div class="newsletter-form__bottom">
|
||||
{#if past}
|
||||
<a href="/subscribe" class="past-issues" data-sveltekit-noscroll data-sveltekit-prefetch>
|
||||
<a href="/subscribe" class="past-issues" data-sveltekit-noscroll>
|
||||
<svg width="20" height="16" viewBox="0 0 20 16" fill="currentColor" xmlns="http://www.w3.org/2000/svg" aria-label="Newsletter icon">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M18 2.346H2a.5.5 0 0 0-.5.5v11.102a.5.5 0 0 0 .5.5h16a.5.5 0 0 0 .5-.5V2.846a.5.5 0 0 0-.5-.5ZM2 .846a2 2 0 0 0-2 2v11.102a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V2.846a2 2 0 0 0-2-2H2Zm13.75 4.25h-2v3h2v-3Zm-2-1a1 1 0 0 0-1 1v3a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2ZM3.5 6.5a.5.5 0 0 0 0 1h6a.5.5 0 0 0 0-1h-6Zm.25 3a.5.5 0 0 1 .5-.5h6a.5.5 0 0 1 0 1h-6a.5.5 0 0 1-.5-.5Zm1.25 2a.5.5 0 0 0 0 1h6a.5.5 0 1 0 0-1H5Z" />
|
||||
</svg>
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
<div class="poster">
|
||||
{#if image}
|
||||
<a href="/shop/poster-{location.slug}" data-sveltekit-noscroll data-sveltekit-prefetch
|
||||
<a href="/shop/poster-{location.slug}" data-sveltekit-noscroll
|
||||
on:click={() => $smoothScroll.scrollTo('#poster', { duration: 2 })}
|
||||
>
|
||||
<Image
|
||||
|
||||
@@ -60,7 +60,7 @@
|
||||
</span>
|
||||
</button>
|
||||
|
||||
<ul class="switcher__links" data-sveltekit-noscroll data-sveltekit-prefetch>
|
||||
<ul class="switcher__links" data-sveltekit-noscroll>
|
||||
{#each switcher_links as { text, url, icon, icon_label }}
|
||||
<li class:is-active={$page.url.pathname === url}>
|
||||
<a href={url} on:click={toggleSwitcher} tabindex="0">
|
||||
|
||||
@@ -14,12 +14,12 @@
|
||||
|
||||
<footer class="footer">
|
||||
<div class="container grid">
|
||||
<a href="/" class="footer__title" data-sveltekit-prefetch data-sveltekit-noscroll tabindex="0">
|
||||
<a href="/" class="footer__title" tabindex="0" data-sveltekit-noscroll>
|
||||
<SiteTitle tag="div" />
|
||||
</a>
|
||||
|
||||
<nav class="footer__links">
|
||||
<ul data-sveltekit-prefetch data-sveltekit-noscroll>
|
||||
<ul data-sveltekit-noscroll>
|
||||
{#each footer_links as { title, slug }}
|
||||
<li>
|
||||
<a href="/{slug}" class="link-3d" tabindex="0">
|
||||
|
||||
@@ -126,7 +126,7 @@
|
||||
<div class="container">
|
||||
<p class="text-label">Choose a city</p>
|
||||
<nav>
|
||||
<ul data-sveltekit-noscroll data-sveltekit-prefetch bind:this={navChooseEl}>
|
||||
<ul bind:this={navChooseEl} data-sveltekit-noscroll>
|
||||
{#each shopLocations as { name, slug }}
|
||||
<li class:is-active={product && slug === product.location.slug}>
|
||||
<a href="/shop/poster-{slug}" on:click={() => $smoothScroll.scrollTo('#poster', { duration: 2 })}>
|
||||
|
||||
@@ -62,7 +62,7 @@
|
||||
<div class="content">
|
||||
<div class="shop__images">
|
||||
{#if images}
|
||||
<a href={enabled ? url : undefined} title="Visit our shop" data-sveltekit-noscroll data-sveltekit-prefetch>
|
||||
<a href={enabled ? url : undefined} title="Visit our shop" data-sveltekit-noscroll>
|
||||
{#each images as { directus_files_id: { id, title }}, index}
|
||||
<Image
|
||||
class={index === currentImageIndex ? 'is-visible' : null}
|
||||
|
||||
@@ -357,7 +357,7 @@
|
||||
<h1 class="title-medium">{currentPhoto.title}</h1>
|
||||
|
||||
<div class="detail text-info">
|
||||
<a href="/{location.country.slug}/{location.slug}" data-sveltekit-prefetch data-sveltekit-noscroll>
|
||||
<a href="/{location.country.slug}/{location.slug}" data-sveltekit-noscroll>
|
||||
<Icon class="icon" icon="map-pin" label="Map pin" />
|
||||
<span>
|
||||
{#if currentPhoto.city}
|
||||
|
||||
@@ -222,7 +222,7 @@
|
||||
<figcaption class="text-info">
|
||||
{about.intro_firstphoto_caption}<br>
|
||||
in
|
||||
<a href="/{about.intro_firstlocation.country.slug}/{about.intro_firstlocation.slug}" data-sveltekit-noscroll data-sveltekit-prefetch>
|
||||
<a href="/{about.intro_firstlocation.country.slug}/{about.intro_firstlocation.slug}" data-sveltekit-noscroll>
|
||||
<img src="{getAssetUrlKey(about.intro_firstlocation.country.flag.id, 'square-small-jpg')}" width="32" height="32" alt="{about.intro_firstlocation.country.flag.title}">
|
||||
<span>Naarm Australia (Melbourne)</span>
|
||||
</a>
|
||||
|
||||
@@ -430,7 +430,7 @@
|
||||
<section class="photos-page__content" bind:this={photosContentEl} style:--margin-sides="{sideMargins}px">
|
||||
<div class="grid container">
|
||||
{#if photos}
|
||||
<div class="photos-page__grid" bind:this={photosGridEl} data-sveltekit-noscroll data-sveltekit-prefetch>
|
||||
<div class="photos-page__grid" bind:this={photosGridEl} data-sveltekit-noscroll>
|
||||
{#each photos as { id, image, slug, location, title, city }, index (id)}
|
||||
<figure class="photo shadow-photo">
|
||||
<a href="/{location.country.slug}/{location.slug}/{slug}" tabindex="0">
|
||||
|
||||
Reference in New Issue
Block a user